It is often a common scenario to trigger multiple instances of a particular part of a BPM process. A typical example would be
You have an array as input, and the same process to run for each of the element set in this array(each element may refer to a particular user tasks)
Every night, a batch process to run and each of the managers in the organization to be notified with the to-be-reviewed activities assigned to them ie, each person should be notified only with his tasks which requires a particular process to be run for each of the managers
This post specifically applies to Oracle BPM Suite 11g 184.108.40.206, before the FeaturePack(FP). In this version, the LoopCounter Variable in the subprocess is not visible, which is a bug. And this post is the workaround for that.
Post FeaturePack release, the variable is available in the Sub-Process, so the process of assigning the individual input in the script task at the starting of the Sub-Process is not required. I'll write another blog for it.
In this example,
there are several managers, and a separate instance of the sub-process(shown below) is to be triggered to each of the managers, paralelly
Input to the sub-process has to be of type Array – thumb rule ;) – as only then, you can split the data and make each of the instances get corresponding data
Schema for the input to the sub-process is given at the end of the post
There is a way to instantiate parallel processes in BPM, and that’s called MultiInstance invocations
1. Create a sub-process and, create the activities that are required to repeat for each manager
2. Now, this should be invoked for all the elements in the array. So some configuration to be done to the sub-process property
My process looked like below
3. Double click the sub-process à
Select multiinstance as loop characteristic
Cardinality is no. of instances to be produced, here it is count (allActivities.reviewerWiseActivities, which otherwise is equal to no. of managers - with tasks)
Uncheck Is Sequencial
Don’t touch Arguments definition tab, as since this is a pre-Feature pack release, there is a bug and you cannot go with the standard way
1. Input to the sub process is an array, but typically each manager has to be assigned only with his tasks, which will be one element in the array. So use a script task as the first activity in the sub-process and copy nth element from the array and assign it to sub-process dataobject
Here, the value in the left box is :: AllActivitiesPDO.reviewerWiseActivities[loopCounter] which is obvious to understand.
Bug in Pre-Feature pack release is that this loop counter is not available in the properties window of the sub process. That’s the reason, we are splitting the array within the subprocess but not before invoking the subprocess.
Had this been post Feature pack release, you can split the array in the properties window of the subprocess, define input and output elements, and skip this script task.
That’s it! Now, n number of sub process instances will start paralelly
Hope this is useful J