How to retrieve the process's unique workflow number, while launching it through C# API?

746 views Asked by At

I'm struggling for 4 days now.

There's this C# Process Engine API: https://www.ibm.com/support/knowledgecenter/en/SSNW2F_5.2.1/com.ibm.p8.pe.dev.doc/web_services/ws_reference.htm

What I need to do is to retrieve the WorkflowNumber when launching the workflow, so later I can find that process in the system.

The issue here is that when you launch it - it returns the LaunchStep (the first step in the workflow) which doesn't have that ID assigned yet - it's null. The only thing available is the LaunchStep's WOBNumber.

In order to assign the Workflow ID to the step, you need to dispatch the step, so I do that:

UpdateStepRequest request = new UpdateStepRequest();
UpdateFlagEnum flag = UpdateFlagEnum.UPDATE_DISPATCH; 

request.updateFlag = flag;
request.stepElement = element; // add the launch step

session.Client.updateStep(request);

And here the funny part happens. From this point, there is complately no option to retrieve that, because StepElements are stateless, updateStep() returns nothing and the best part - the LaunchStep is now destroyed in the system, because it's a LaunchStep - it just gets destroyed after the launch.

Any tips would be appreciated!

0

There are 0 answers