Skip to main content
How can I get the process version number for a particular process instance in my aspx form? I have found SourceCode.Workflow.Management.ProcessVersions (etc) but have no idea if that is what I need!

thanks

Simon

Hi Si_b,

           Can you explain bit more, what do you want to do with process instance, Are you talking about

WorklistItem.ProcessInstance.Id ?
 


As you know, every time you deploy a workflow K2 deploys it with a new version number. What I want to get at is that actual version number. Say I start a new instance ("instance A") at version 1, then deploy a new version, then start another instance ("instance B"), I want to be able to show on the aspx form "instance A - process version 1" or "instance B - process version 2" as appropriate.

This would be useful functionality to add to our applications. Our users like to know exactly what version of the workflow they are running. It would also help our helpdesk out.


 


Martin


Is there any solution for this? I also would like to know this :)


 


Best regards,


Chris


You can get the version number from the Management API. Sample code:



SourceCode.Workflow.Management.WorkflowManagementServer oS = new SourceCode.Workflow.Management.WorkflowManagementServer();
oS.CreateConnection();


oS.Connection.Open(ConStr);
SourceCode.Workflow.Management.Criteria.ProcessInstanceCriteriaFilter f2 = new SourceCode.Workflow.Management.Criteria.ProcessInstanceCriteriaFilter();


f2.AddRegularFilter(SourceCode.Workflow.Management.ProcessInstanceFields.ProcInstID, SourceCode.Workflow.Management.Criteria.Comparison.Equals, "164"); // Use the ProcInstID


SourceCode.Workflow.Management.ProcessInstances ps = oS.GetProcessInstancesAll(f2);


 


if (ps.Count == 1)


{


    int iVer = oS.GetProcess(pss0].ProcID).VersionNumber;


}


else


{


    // Handle not found


}



 


Just note that the account executing this code need to be an Administrator on the K2 Server.


Reply