To create reusable process

How to call an activity repeatedly, for instance like 3 times?

Until the count is reached, I want this OCR activity to be alive

loop

1 Like

Hi @Minisha_M ,

You can configure the multi-instance characteristics to the Call Activity. A multi-instance activity is a way of defining repetition for a certain step in a business process. In programming concepts, a multi-instance matches the for each construct: it allows execution of a certain step or even a complete subprocess for each item in a given collection, sequentially or in parallel.


Three vertical lines indicate that the instances will be executed in parallel , while three horizontal lines indicate sequential execution.

image

  • nrOfInstances : the total number of instances
  • nrOfActiveInstances : the number of currently active, i.e., not yet finished, instances. For a sequential multi-instance, this will always be 1
  • nrOfCompletedInstances : the number of already completed instances

You can configure your bpmn model like below (multi-instance sequential execution):


Here the collection variable processList contains array of ProcessDefinitionKeys . Element variable or iteration variable called someSubProcess which holds the ProcessDefinitionKey of the subprocess needs to be invoked.

<bpmn:callActivity id="Activity_0vpe19a" name="OCR" camunda:asyncBefore="true" calledElement="${someSubProcess}">
      <bpmn:incoming>Flow_0ymomiv</bpmn:incoming>
      <bpmn:outgoing>Flow_0uhiduz</bpmn:outgoing>
      <bpmn:multiInstanceLoopCharacteristics isSequential="true" camunda:asyncBefore="true" camunda:collection="${processList}" camunda:elementVariable="someSubProcess" />
</bpmn:callActivity>

Refer this post:

Completion condition in multi-instance activity:

2 Likes

I use, modeller version:3.3.4, and I couldnt find an option to set multi-instance characteristics. Should I edit, the xml directly then?

@Minisha_M Select the activity, click on the settings icon like below, you can find the task markers (parallel, sequential, loop) in the first row.

image

image

1 Like

I want to retrigger the activity until a condition is met. But loop cardinality seems mandatory is there a way to skip it?

Don’t configure the loop cardinality for multi-instances.

Sequential execution --> From call activity, once process A completed, then Process B starts, and then process c and goes on.

Parallel execution --> from call activity, initiates all the subprocess in parallel and will wait until all the subprocess completes for execution.

Hello @Minisha_M, you can configure a cancel condition even without a loop. So for example within that multi-instance you can set a process variable value and check that variable as cancel condition.