[Reprint] use C # code to initiate the K2 Blackpearl Process

Source: Internet
Author: User

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:

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.