Current Process Version?


Badge +8

I need to be able to version the aspx web forms that act as the front end to our K2 BlackPearl workflows.  For example:


1) Deploy version 1 of workflow and aspx forms to go with it


2) Various users start processes on version 1 workflow


3) Add a new data field to workflow and deploy.


4) Forms need to know which version of the workflow is running so it can display the proper fields.


It has been suggested to me that I should have a data field in my workflow that gets set at run time by the workflow (which I am fine with).  However, I can't seem to find a variable in the workflow that contains the process version to assign it.


If there is a better way to handle versioning of aspx forms, I'm all ears.


2 replies

Badge +6

You need to have a server event in the workflow and assing the process version value to the data field using code


e.g.


string _k2server, _k2port, processName;


_k2server = "localhost";


_k2port = “5555”;


processName = “projectyourprocessname”;


 


WorkflowManagementServer svr = new WorkflowManagementServer(_k2server, _k2port);


svr.Open();


try


{


//get the list of active process instances


ProcessInstances procInsts = svr.GetProcessInstancesAll(processName, "", "");


//get the proc set ID from the first item in the list


if (procInsts.Count > 0)


{


Processes procs = svr.GetProcessVersions(procInsts[0].ProcSetID);


//get the latest proc version from the returned list of process versions


int latestProcVersion = 0;


foreach (Process proc in procs)


{


if (proc.VersionNumber > latestProcVersion)


latestProcVersion = proc.VersionNumber;


}

Badge +8

Thanks, this got me where I wanted to go.


A critical piece I was missing was how to add a reference to SourceCode.Workflow.Management, which I found here about half way down the page.

Reply