K2 API to Expire an activity

  • 8 October 2011
  • 3 replies
  • 2 views

Badge +2

I there an API in K2 BlackPearl (such as in KO.dll or K2Mng.dll or any other k2 dll) that I can use to Expire an acitivity? I need to be able to do this from an external client application such as a console app (i.e. outside of the k2 server). I have the process instance ID and activity name that I would like to expire.


Thanks.


Abhijeet


3 replies

Badge +9

Sure, you can reference SourceCode.HostClientAPI.dll, SourceCode.Workflow.Client.dll and SourceCode.Workflow.Management.dll to get to some methods that will do what you are looking for.  There is good documentation on this API included in the product, but if you are having trouble finding the Expire method let me know and I'll take a look at getting you the specifics.

Badge +2

I couldn't find the exaclt method, can you please post the specific dll, class and method I can use for this?


Thx.


Abhijeet


 

Badge +10

Hi,


You can use the SourceCode.Workflow.Management API and call the GotoActivity() method of the WorkflowManagementServer object to have the process go to another step in the workflow, expiring the current step. The user executing this code must be an administrator on K2. Also remember that this API requires that you reference SourceCode.HostClientAPI in order to construct the connection to the server.


There are no examples of doing exactly this, but there is an example of how to open a connection and work with this DLL in the Developer Reference which is installed with the K2 Documentation (Under Developer Reference > Processes > Managing > How to set rights on a process).


Hope this helps!

Reply