Thursday, 15 May 2014

K2 Blockpearl Custom code

sourcecode.workflow.client
need to add above name space to use k2 API in asp.net
 
Declarations before PageLoad
SourceCode.Workflow.Client.Connection m_oConn = null;
//bp server from the web.config
private string m_strBPServer = System.Configuration.ConfigurationManager.AppSettings["WorkflowServer"];
 
Open the connection at the beginning of PageLoad
// open the connection
m_oConn.Open(m_strBPServer);
 
————————————————————
 
using (SourceCode.Workflow.Client.Connection con = new Connection())
{
con.open(“workflowserver”);
ProcessInstance pi = con.CreateProcessInstance(“workflowproject\\workflowprocess”); pi.DataFields["fieldname"].value = “value”;
con.StartProcessInstance(pi);
}