Question on multi instance

I am using multi instance to spin off a series of approval user tasks using loopCardinality. For approval, I want decision taken to be approve for each of the tasks but for rejections, I want to discard other instances after I see first task of rejection. How can I accomplish this?

Hi,

Ive not tried this so no guarantee, but could you put an interrupting boundary event on the MI and thus catch a business exception (BpmnError) and exit the MI. Thus if inside the MI you have a task which rejects something, have it throw the BpmnError…

regards

Rob

Is there a way to get handle of process execution from JavaDelegate and disable the other approval tasks?

Maybe you can put the logic into a multi-instance-subprocess?

Cheers, Ingo

Hey,

you can use a boundary event and a multi instance sub process in combination like Ingo and Webcyberrob said.

See the following example process:

The UserTask approves or rejects the request the exclusive gateway checks a variable if the request was rejected or not.
If it was rejected an signal end event is triggered, which triggers the boundary event on the multi instance sub process.
This will cancel the execution of the multi instance. If the request was approved the current execution of the multi instance simply ends and is repeated until the cardinality is reached or a request is rejected.

On end of November Camunda releases the new version (7.6) of the Camunda engine, which cames with a new feature the support of conditional events, so the process can look like this:

On the execution of the UserTask you can set the variable rejected=true, to trigger the conditional boundary event.

Hope that helps.

Best regards,
Chris

Hi Zelldon,
Thanks for give me a direction on this. When I try this, signal throw is not exiting the sub-process on first reject of “Approve” task. It only exits after two “Rejections”. IS there a way to make it exit the sub-process upon first rejection. Also, if the first instance rejects and the second one approved it, the overall decision is taken as “Approved”.
You may test that yourself by making “Approve” multi-instance with loop cardinality 2.
Below is a snippet from my BPMN model

Any thoughts on this?

Hey @Vaithee_Subramanian,

you have to make the subprocess multi instance not the user task.

Best regards,
Chris

Hi folks,

one remark from my side:

Maybe you should rather use escalation events instead of signals, because signals could potentially kill other process instances, too.

Cheers, Ben

1 Like

Thank you all. That solved my problem.

2 Likes

Hi, I’m modelling a similar process using multi instances, but I can’t understand how configure it for this fields:

-Loop Cardinality
-Collection
-Element variable
-Completition condition

Can you give me some references or indicate/share a bpmn as sample?

Thanks a lot! Regards

Hi Anoonior,

please do not reopen old posts with new (not real related) questions.
Next time please open a new post, but to answer your question please take a look into the corresponding multi instance documentation

Greets
Chris