Adding Additional Instances to a Multi-instance Loop While the Task is Still in Progress
This implements control-flow pattern WCP-15.
See the table "Supported Control Flow Patterns" in Workflow Process Patterns Support.
To do this, you need to execute a script somewhere on a parallel path whilst the loop task is active. The script can add instances to the loop task using an expression similar to the following:
bpm.process.addActivityLoopAdditionalInstances ("OrderStock",1);
which contains a string for the name of the task (in this example, OrderStock), and an integer for the number of additional instances required (in this example, 1)..
You can also add additional instances to a loop in the loop task itself, but only in the task Complete script.
In this example, the task Add parts to order would order an additional item each time it was used.
This workflow pattern specifies that multiple instances of an activity should be created, each instance being synchronized and able to run concurrently.
The following process has three activities:
There can be multiple instances of the Each Direct Debit task. This is indicated on the General tab of the Properties view:
The details are specified on the Loops tab:
The Parallel ordering setting and All flow condition means that the activity instances will be performed at the same time and will be synchronized. The number of instances is set to 3 on the right side of the Properties view.