Skip to main content

I need to be able to return all the users that a particular activity instance is assigned to using the K2 API.


This is because worklist items are generally assigned to multiple users - a user, a team user and a department user. Individuals are able to log in as their actual user, or their team or department user to view all worklist items assigned to their team or department. When someone is viewing the team or department worklist, they want to be able to see the real users that each item is assigned to.


Currently I'm trying to use the WorkflowManagementServer.GetActionInstanceRights function, but it just returns me an empty list. I have previously tried to use the WorkListItem.DelegatedUsers property for this, but this is also empty.


Has anyone tried to do this before and had any luck?


We are on blackpearl 4.5


Thanks!

You'll need to create your own SmartObject for this.

 

When I had to do it, I created a SQL Server service instance that looked at the K2 database, and then I just pulled out the _ActInstDest records for my current ProcInstID and ActInstID.


Hello all,

 

I came up with this sample and it's working with me just fine:

 

static void Main(stringn] args)
{

WorkflowManagementServer workflowManagementServer = new WorkflowManagementServer();
workflowManagementServer.Open("Integrated=True;IsPrimaryLogin=True;Authenticate=True;EncryptedPassword=False;Host={Server};Port={Port};UserID={UserId};WindowsDomain={Domain};Password={Password}");

var criteriaFilter = new WorklistCriteriaFilter();
criteriaFilter.AddRegularFilter(WorklistFields.Folio, Comparison.Equals, "7d0c86fd-7f95-4d28-9b36-8e2522effd5d");
WorklistItems worklist = workflowManagementServer.GetWorklistItems(criteriaFilter);

IEnumerator e = worklist.GetEnumerator();
while (e.MoveNext())
{
Console.WriteLine(((WorklistItem)e.Current).Destination);
}

Console.ReadLine();

}

 

Best Regards

Ramy Essam


Just as a note to help make the code a bit more easier to manage, on the SourceCode.HostingBaseAPI there is an SCConnectionStringBuilder that is great for creating connection string for server connections to K2.


Reply