+1 vote
5.0k views
in BPD by

2 Answers

+4 votes
by (16.3k 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.

https://bpm.tips/?qa=blob&qa_blobid=15889201645141111293.

0 votes
by (16.3k points)

Related questions

0 votes
1 answer 1.7k views
0 votes
1 answer 551 views
+1 vote
2 answers 5.2k views
0 votes
1 answer 1.2k views
0 votes
0 answers 428 views
0 votes
0 answers 402 views
0 votes
1 answer 1.4k views
0 votes
1 answer 1.8k views
0 votes
0 answers 304 views
0 votes
1 answer 1.5k views
asked May 19, 2016 in BPD by anonymous
0 votes
1 answer 842 views
0 votes
0 answers 295 views
0 votes
1 answer 1.5k views

635 questions

495 answers

98 comments

3.0k users

Join BPM Community Discord Channel

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.
Created by Dosvak LLC
Our Youtube Channel
...