Get ProcessInstances

  • 31 October 2006
  • 5 replies
  • 0 views

Badge +2
I am coding a application to get All ProcessInstances in K2Server which originator by a specific person.

I used K2Manager to get All process , but the class K2Manager.ProcessInstance don't have any method to access the Destination Activity object.

Show me the solution ,pls!

Thanks a alot !

5 replies

Badge +11
Have a look at the sample posted here:
http://forum.k2workflow.com/viewtopic.php?p=5862#5862

I have not tested it myself but hopefully it can help you.

Regards,
Ockert
Badge +13
Open K2MNG Help file search for GetProcessInstancesAll. It has sample code.

Originator
Filter the result based on the Originator of the ProcessInstance.

Public Function GetProcessInstancesAll( _
Optional ByVal FullName As String, _
Optional ByVal Folio As String, _
Optional ByVal Originator As String, _
Optional ByVal FromDate As String, _
Optional ByVal ToDate As String _
) As ProcessInstances
Badge +2
But use ProcessInstance class in K2Manager namespace, we can't get the Destination Activity name and the Destination User of the current processInstance.

We can do it with WebServices support by K2 (FilterService).??????

Help me!!
Badge +13
Dim oWorklistItems As K2Mng.WorkListItems

oWorklistItems = oK2Manager.GetWorkListItems(strDestination, strProcess, strActivity, strEvent, strFolio, strStartDate, strEndDate)

Use that and you can get the ActivityName, there is a oWorklistItems.Destination object but I have not figured out how to use that Destination object... someone from K2 can assist?
Badge +9
The K2Mng.WorklistItem.Destination object is a string, so just doing a ToString() on it should return the destination user for that specific worklist item.



WorkListItems oWorklistItems = oK2Manager.GetWorkListItems(strDestination, strProcess, strActivity, strEvent, strFolio, strStartDate, strEndDate);

if (oWorklistItems.Count > 0)
{
foreach (WorkListItem oWorklistItem in oWorklistItems)
{
string strActivityName = oWorklistItem.ActivityName;
string strDestinationUser = oWorklistItem.Destination.ToString();
string strEventName = oWorklistItem.EventName;

// do something with the values here
}
}

Reply