Do you want to Search Something?

Those who opened the gates

Tuesday, May 15, 2012

How to stop a Workflow Process Instance via eScript

This can be achieved using the  _StopInstance method of Worflow Process Manager BS

An example usage of this technique occurs when you have an interactive workflow which needs to be cancelled but which is suspended in a Wait step. In this scenario, the Process Instance Id is already known.

To stop a workflow process instance from script

Invoke the _StopInstance method on the Workflow Process Manager business service, as in the following example, which uses a hard-coded Process Instance Id:


var bs = TheApplication().GetService("Workflow Process Manager");
var ps_inputs = TheApplication().NewPropertySet();
var ps_outputs = TheApplication().NewPropertySet();
ps_inputs.SetProperty("ProcessInstanceId", "1-IIT");
bs.InvokeMethod("_StopInstance" , ps_inputs, ps_outputs);

Comes in handy while you want to dliberately stop that annoying instance:)