Hi Everyone,
I am trying to get all of the Worklist items from a K2 server using a ProcInstID and ActInstDestID.
How can I do this using the API?
Thanks.
Hi Everyone,
I am trying to get all of the Worklist items from a K2 server using a ProcInstID and ActInstDestID.
How can I do this using the API?
Thanks.
I don't think there's a direct way to query it, but if you know the Destination user, it can be quite simple. Sample code below:
WFM.WorkflowManagementServer wfmServer = new SourceCode.Workflow.Management.WorkflowManagementServer();
int iProcInstID = 10,
iActInstID = 11;
try
{
wfmServer.CreateConnection();
wfmServer.Connection.Open("Integrated=True;IsPrimaryLogin=True;Authenticate=True;EncryptedPassword=False;Host=blackpearl;Port=5555");
WFM.Criteria.WorklistCriteriaFilter oFilter = new SourceCode.Workflow.Management.Criteria.WorklistCriteriaFilter();
oFilter.AddRegularFilter(WFM.WorklistFields.Destination, SourceCode.Workflow.Management.Criteria.Comparison.Equals, "K2:DenallixAnthony");
WFM.WorklistItems oItems = wfmServer.GetWorklistItems(oFilter);
foreach (WFM.WorklistItem oItem in oItems)
{
if (oItem.ProcInstID == iProcInstID &&
oItem.ActInstDestID == iActInstID)
wfmServer.RedirectWorklistItem("UserA", "UserB",
oItem.ProcInstID, oItem.ActInstDestID,
oItem.ID);
}
}
finally
{
if (wfmServer.Connection != null && wfmServer.Connection.IsConnected)
wfmServer.Connection.Close();
}
Hi dc,
Given that I can readily get these items, can I delete the process or stop it to prevent it from showing in the worklist report?
Thanks.
Yes, have a look at the WorkflowManagementServer object in the Help File, it has methods to Stop and Delete instances.
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.