Design Process
1. Create a new project
A) Open K2 studio designer, File> New> Project
B) For example,
Project type: K2
Template: K2 Empty Project
Name: k2lab2_api
Location: C: "lab" lab2 "Process
2. Set up process processapi
A) Right-click a process project and choose add> existing items.
B) Find C: "lab" lab0 "process" k2workflowprojectlab0 "k2workflowprojectlab0" process1.kprx and click "add"
C) process1.kprx, renamed as: processapi. kprx
3. Add process datafield
A) View> k2 Object Browser
B) For example, go to the process/activity data tab (the third icon) and expand data fields.
C) Right-click processapi and click Add.
L field name: applicant; Initial Value: John
L field name: content, initial value: Content
L field name: remark, initial value: Approval comments
4. Add code
A) In server events of the approved and declined nodes, use the following code to output all variable values:
Console. writeline ("approve (or declined)-processinstance. datafields. Count =" + K2. processinstance. datafields. Count. tostring ());
For (INT I = 0; I <K2. processinstance. datafields. Count; I ++)
{
Console. writeline (K2. processinstance. datafields [I]. Name. tostring () + "=" +
K2. processinstance. datafields [I]. value. tostring ());
}
5. Modify the URL attribute of clienteventapproval
A) modify the clienteventapproval URL to http: // localhost/lab2website/approval. aspx.
6. Deployment Test
A) test in K2 workspace to ensure the process is correct