开发者

K2 Process Cancellation

I am assigned a task on K2 Blackpearl th开发者_JS百科at involves programmatically stopping the process of certain workitems directly without using the product's interface as it does not serve the purpose.

The problem is that in this business requirement, a specific proponent can have multiple document uploads which was possible by making a custom application that reads rows from an excel file and uploading to K2 automatically.

The developers of this solution are no longer present and the details of their work are unavailable.

I am just told that stopping of processes can be done using a custom console application.

Can someone please teach me the right path? I have no prior experience on K2 so this is a huge task for me as I am unfamiliar with its flow.


K2 APIs are very well documented with sample code and demo applications you can download from K2 underground.

The answer to your question is here: k2underground.com/forums/p/12082/35429.aspx

I've pulled out the relevant lines of code:

// references

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SourceCode.Workflow.Management;
using SourceCode.Hosting.Client.BaseAPI;

// code

// connection string
SCConnectionStringBuilder scBuilder = new SCConnectionStringBuilder();
scBuilder.Authenticate = true;
scBuilder.IsPrimaryLogin = true;
scBuilder.Integrated = true;
scBuilder.Host = "localhost";
scBuilder.Port = 5555;

// connect to K2 Server
WorkflowManagementServer wfmServer = new WorkflowManagementServer();

wfmServer.CreateConnection();
wfmServer.Connection.Open(scBuilder.ConnectionString);

// optionally get a list of process instances to explore
/*
ProcessInstances procInst = 
  wfmServer.GetProcessInstancesAll(string.Empty, string.Empty, string.Empty);
*/

// when you've got a proc inst you're interested in, stop it.
int _procInstId = 123; // get this from your process instance context
wfmServer.StopProcessInstances(_procInstId);

You can find more code samples here: Tim Byrne's blog re: K2

Out of dozens of available namespaces in the API, the most common namespaces in use are (by the way, the name of the company is SourceCode):

> Sourcecode.Workflow.Client
> SourceCode.Workflow.Management
> SourceCode.SmartObjects.Client

Hope that helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜