Skip to main content

Hi,


Would anyone know how I can retrieve the serial number of a workitem from a windows form by any means.


Our workflows are created from a windows form using the 'StartProcessInstance' method. Once the workitem has been created you have access to serveral properties, one of which is ID, but unfortunatelty I require the serial number that includes the activity (eg 1234_13 as opposed to just 1234).


Any help would be greatly received.


Many thanks,


Kevin,

Hey Kevin,

                Logic is same, does not matter either windows forms or web.

If you are using win forms then you might be having customized workspace or some part of your windows app which lists all the process instance.

you can fetch the process on click of one of process instance or worklist item.you can fetch SourceCode.Workflow.Client.WorklistItem.serialnumber 

or

You would have server events and for that you can just write code with full k2 context available to you.

 

 

 

 

 


 


Kevin,


When you first start a process instance, all you have is the process ID.  A serial number doesn't come into existence until you hit a client or server event.  The serial number changes over time as you progress through the events and activities of the workflow.


If you want to get a list of tasks, I suggest taking a look at the SourceCode.Workflow.Management API.


David


You may also think about "StartProcessInstance" in synchronous mode. There is an overload method to specify this setting on the StartProcessInstance method. In synchronous mode, the K2 server will execute the process until the first client event or asynchronous server event is reached. At this point control will be handed back to your WinForm application at which point you will be able to obtain the serial number. To do this you can then search for any worklistitems using the ProcessInstance.ID and therefore obtain any serial numbers for any worklist items assigned to the user logged onto the WinForm application.

Reply