Skip to main content

Do Default Client Events HAVE to be put into a K2 worklist in order to be able to retrieve them again using the SerialNumber?

Or is there a way to just use the SerialNumber on it's own and not have to place the item in someone's worklist?

Basically, due to a requirement for a more complex prioritisation of workitems for users, we are implementing our own 'worklist' functionality and i'm wondering if i can still use Default Client events in the K2 studio to make the process diagram a little easier to understand rather than a Default Server Event.

thanks,

Wes

All events have serial numbers. The only difference between "Client Side Code" and "Internet" generated code is the AddWorklist function witch will display the item in the K2.net 2003 Worklist.

Example Code


Sub Main(Byval K2 as ClientEventContext)
Try
HTTPFunction(K2)
Catch Ex as System.Exception
Throw New System.Exception(ex.Message)
End Try
End Sub
Function HTTPFunction(Byval K2 as ClientEventContext)
Dim strURL as String
strURL = "http://test/test.aspx?sn={SERIALNO}"
strURL = strURL.Replace("{SERIALNO}",K2.SerialNumber)
K2.AddWorklist("ASP",System.Web.HttpUtility.UrlPathEncode(strURL))
End Function



Look at the following example to retrieve the worklist using the K2ROM:

.Value = System.DateTime.Now.Hour.ToString() + ":" + System.DateTime.Now.Minute.ToString(); 

oWorkListItem.Update();
//OR
oWorkListItem.Finish();
}
else if(oWorkListItem.ProcessInstance.Folio == strFolio)
{
oWorkListItem.GotoActivity("Declined", false); //Force the process to another Activity contained in the same Process
//OR
oWorkListItem.Redirect(strNewDestination); //Redirect the WOrkitem to a different user
//OR
oWorkListItem.Sleep(true, 24); //Removes the workitem from the users worklist for the duration specified in seconds
}
}
}
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}



thanks for your reply David

but i'm not sure like the idea of opening the entire worklist and looping through every item to find the correct Serial Number

creating a server item and then using the OpenServerItem method seems to be a lot more efficient if i am always going to know the Serial Number
If you do know the Serial Number before-hand, you can of course always use the connection object's OpenWorklistItem method:

oK2Connection.OpenWorklistItem(strSerialNumber, "ASP", True, False)

Regards,
Ockert
icon-quote.gifOckert:
If you do know the Serial Number before-hand, you can of course always use the connection object's OpenWorklistItem method:

oK2Connection.OpenWorklistItem(strSerialNumber, "ASP", True, False)

Regards,
Ockert


aha, but this comes back to my original question...

icon-quote.gifwez_p:
Do Default Client Events HAVE to be put into a K2 worklist in order to be able to retrieve them again using the SerialNumber?


since using the OpenWorkListItem method requires the item to have been placed on a worklist right? i don't really need the worklist functionality so was just originally wondering if i could still use the Client Event in the designer to make the process diagram easier to read, but not have to add the item to a worklist

thanks all for your help on this
All this to get to the answer of your original question: YES, Client Events need to be in a Worklist to retrieve through a serial number.

Sorry it took so long.

Regards,
Ockert
icon-quote.gifOckert:
All this to get to the answer of your original question: YES, Client Events need to be in a Worklist to retrieve through a serial number.

Sorry it took so long.

Regards,
Ockert


lol

muchos gracias!
If the activity has only a client event, I can use the same serial number and open it via OpenWorklistItem and also OpenServerItem?

Does that mean I can always use OpenServerItem?
Otherwise when would I want to use OpenWorklistItem instead of OpenServerItem?
A Synchronous Server Event is for all practical purposes the same as a Default client event. The only difference is that the client event will be made available to users through a Worklist or Tasklist whereas the server event will not be available through any K2.net specific (or custom worklist) front-end.

I have not actually tested this but I think the user opening the connection through K2ROM, will need 'Server Event' (or 'Admin') permissions to open the item with 'OpenServerItem'.

HTH,
Ockert

Reply