+1 vote
in BPD by

1 Answer

+3 votes
by (10.6k points)

In a BPD(Business Process Diagram), you can make any activity/javascript be a simple loop or a multi-instance loop implementation e.g. System Service, Human Services and Linked Process or Sub-Process and even scripts, A simple loop means that the connected service/process/task/script will run in sequence for the defined number of times with a single token, whereas a multi instance loop means it may run in parallel or sequence(as chosen) for the defined number of times with individual separate tokens for each instance.

You generally use a list variable to supply the input data to each instance, each instance gets a member of the list variable to work upon, additionally you can supply common data also to the instances.

The index of the list which will match the current step/instance (the counter for the instances) is retrieved using

tw.system.step.counter, so the index of the current item for the list will be tw.system.step.counter - 1 since list indexes start with 0

A simple use case is lets say a person chooses how many approvers will be for a given task, we will have to generate as many tasks as the number of approvers added.

You can have a scenario where all approvers will need to approve before we can move forward, or a scenario where any approver approving moves the flow forward, this is done by conditional wait till a certain condition is true and cancelling remaining instances, you may have a scenario that when a certain condition is met come out of the loop but let the remaining instances run, when the additional instances exit they will introduce additional token and you will have multiple tokens in you process.

The most complex scenario i have seen for a multi-instance loop is where in a user chooses approvers we generate tasks for each approver, but any one of the approver can add additonal approvers and we have to add as many additional approvers to the task list but the approval task is essentially same.

The solution used was a self joining multi instance linked process, it is'nt easy to implement especially in the conditional exit area and keeping in mind pass by reference. the exit condition was if any approver rejects cancel all remaining tasks and exit to main process or wait for all approvals adhoc and main ones to come in.

I am attaching a skeleton of the implementation, its not a fully executing one. later I will try to post a fully working version also.


Related questions

0 votes
1 answer 309 views
+1 vote
1 answer 549 views
0 votes
1 answer 165 views
0 votes
0 answers 68 views
0 votes
0 answers 129 views
0 votes
1 answer 224 views
0 votes
1 answer 271 views
0 votes
1 answer 69 views
0 votes
1 answer 252 views
0 votes
0 answers 47 views
0 votes
1 answer 143 views
asked May 19, 2016 in BPD by anonymous
0 votes
1 answer 65 views
0 votes
0 answers 50 views

495 questions

405 answers


1.6k users

Created By Dosvak LLC (WWW.DOSVAK.COM)
Our Public Git Repository

Dosvak UI Toolkit --- Download --- Demo

Subscribe us at

Welcome to BPM Tips Q&A, Community wiki/forum where you can ask questions and receive answers from other IBM BPM experts and members of the community. Users with 2000 points will automatically be promoted to expert level.