Hello everyone,
What is the trick to getting a process instance for a completed workflow?
I have the code below to retrieve an instance that I (as an administrator of K2 and full access to the particular process) started. On line 16, where I try to open the process instance, I get an error that states:
26023 Process instance 2203 not found for K2:LITTLER-USGAndora at 10.90.0.20:644
Can anybody let me know what I'm doing wrong?
Thanks a lot,
Greg Andora
The code isn't being diplayed too well on this site, here is a link to it on Windows Live:
Link to Code HTML file
1: private void GetWorkflow()
2: {
3: //for process instantiation
4: string serverName = "sfrmsk2";
5: string procId = "2203";
6:
7: //BEGIN PROCESS
8: //Instantiate the Connection Object
9: using (SourceCode.Workflow.Client.Connection K2Conn = new SourceCode.Workflow.Client.Connection())
10: {
11: //Open the Connection Object
12: K2Conn.Open(serverName);
13:
14: //Declare the Process Instance Object
15: SourceCode.Workflow.Client.ProcessInstance K2ProcInstance;
16: K2ProcInstance = K2Conn.OpenProcessInstance(int.Parse(procId));
17:
18:
19: StringBuilder sbWorkflowFields = new StringBuilder();
20: sbWorkflowFields.AppendFormat("<table>");
21: sbWorkflowFields.AppendFormat("<tr><th>Field Name</th>");
22: sbWorkflowFields.AppendFormat("<th>Value</th>");
23: sbWorkflowFields.AppendFormat("<th>Type</th>");
24: sbWorkflowFields.AppendFormat("<th>Hidden</th>");
25: sbWorkflowFields.AppendFormat("</tr>");
26:
27: foreach (DataField f in K2ProcInstance.DataFields)
28: {
29: sbWorkflowFields.AppendFormat("<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td></tr>", f.Name, f.Value, f.ValueType, f.Hidden);
30: }
31:
32: Literal1.Text = sbWorkflowFields.ToString();
33:
34: K2Conn.Close();
35: }
36:
37: //END OF PROCESS CODE
38: }