How to get the Task Item Url (ClientEvent URL) using code or The Out the Box service Object ?

  • 12 March 2017
  • 1 reply
  • 2 views

Hi

 

I would like to create a kind of cutsom K2 Worklist

Unfortunately, I didnt manged to get all the information that I would need to do it using the The Workflow reporting service Object.

I have also try to get the Client Event URL using the K2 API

 

 workflowServer.CreateConnection();
workflowServer.Connection.Open(connectionString.ToString());

 

 foreach (WorklistItem worklistItem in workflowServer.GetWorklistItems("", "", "", "", "", "", ""))
  {

                        Console.WriteLine("Process Name: " + worklistItem.ProcName.ToString());
                        Console.WriteLine("Start Date: " + worklistItem.StartDate.ToString());

                        Console.WriteLine("ProcInstID: " + worklistItem.ProcInstID.ToString());
                        Console.WriteLine("ActInstDestID: " + worklistItem.ActInstDestID.ToString());

 

 }

 

It doesnt seem to be possible to retrieve the URL from the WorklistItem Object

 

Please, could you help me to get the the Client event URL for a specific destination user and for a specific workflow active instance ?

 

Thanks a lot for your help

 

Regards,

 

Amazigh


1 reply

To do this you need to use the workflow client API (SourceCode.Workflow.Client) instead of the management API. The client API is limited to opening the worklist of one user at a time instead of all worklist items on the server, but it sounds like that's what you want to do anyway.

 

using SourceCode.Workflow.Client;

Connection workflowClientServer = new Connection;

workflowClientServer.Open(connectionString.host, connectionString.ToString());

workflowClientServer.ImpersonateUser(@"K2:<domain><username>");

 

foreach (WorklistItem worklistItem in workflowClientServer.OpenWorklist())

{

                        Console.WriteLine("Process Name: " + worklistItem.ProcessInstance.Name.ToString());
                        Console.WriteLine("Start Date: " + worklistItem.ProcessInstance.StartDate.ToString());

                        Console.WriteLine("ProcInstID: " + worklistItem.ProcessInstance.ID.ToString());
                        Console.WriteLine("ActInstDestID: " + worklistItem.ActivityInstanceDestination.ID.ToString());

                        Console.WriteLine("URL: " + worklistItem.Data);

}

Reply