Use the C # code to initiate a K2 process. The form is similar to the code used to connect to the SQL Server database. It is through the connection string, then OPEN, and then... you know.
The following code is initiated by the K2 process for your reference only. At the same time, if you have knowledge of K2, please give me more advice.
Protected void ProcessSubmit_Click (object sender, EventArgs e)
{
// Create a connection object
SourceCode. Workflow. Client. Connection wfcon = new SourceCode. Workflow. Client. Connection ();
// Open the Link (input the K2 server and its port)
String k2Server = System. Configuration. ConfigurationManager. receivettings ["K2Server"];
String workflowServicePort = System. Configuration. ConfigurationManager. receivettings ["WorkflowServicePort"];
Wfcon. Open (k2Server + ":" + workflowServicePort );
// Create a process instance
SourceCode. Workflow. Client. ProcessInstance proInst = wfcon. CreateProcessInstance (@ "TestProcess \ ProcessDHFKSQ ");
// Specify the process ticket number
ProInst. Folio = Folio. Text;
// Assign a value to DataField in the process
ProInst. DataFields ["HigherLevelApprover"]. Value = HigherLevelApprover. Text;
ProInst. DataFields ["FinanceApprover"]. Value = FinanceApprover. Text;
ProInst. DataFields ["ApprovalPage"]. Value = System. Configuration. ConfigurationManager. receivettings ["ApprovalPage"];
// Initiate the process
Wfcon. StartProcessInstance (proInst );
// Store data to SmartObject
SaveData (proInst. ID );
// End
Wfcon. Dispose ();
Response. Write ("<script language = 'javascript 'Type = 'text/javascript '> window. close () </script> ");}
The flowchart is as follows: