Possible to have multi instance call activity - but each iteration with different calledElement dynamically?

Hello,

I’m new to Camunda / BPMN and I’ve come across a use case like below and want to understand if I can solve this by multi instance call activity and if not any other best practice to do this?

Can I run the multi intance call activity that can run a different sub process every iteration? let’s say below is my process model and I want to execute the multi-instance call activity (Sequential) to perform complex task X, Y and Z in that order. ( additional constraint is that I may have some more actions than X, Y and Z in future which I may not know now but I want to simply create another sub process and run rules task will return that action also which can be handled by multi instance activity)

Thanks,
Vaibhav

Hi @vaibs,

as the process engine supports expressions in the calledElement, you can indeed call different processes in a multiinstance call activity.

Here is a test method for the expressions: https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/callactivity/CallActivityTest.java#L132-L160 using this process model: https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/resources/org/camunda/bpm/engine/test/bpmn/callactivity/CallActivity.testCallSimpleSubProcessWithExpressions.bpmn20.xml

Hope this helps, Ingo

1 Like

Hi @Ingo_Richtsmeier,

Thanks, yes that was the plan to use the expression / dynamically setting the calledElement, the thing is I wanted to do it in a loop, so it could still be leveraged and be done.

I think with multi-instance call activity it’s not possible i.e. each instance will execute only one process definition, right?

Hi @vaibs,

yes, but you can create a list like Arrays.asList("processOne", "processOne", "processTwo", "processThree", "processOne");

Hope this helps, Ingo

Thanks @Ingo_Richtsmeier, so conclusion is not to use multi-instance call activity here but instead use a single instance call activity and manage the loop yourself, in each loop set the calledElement to whatever process you need to start