Using a multi-instance
You can add multiple executions to user activities and subprocesses. This requires that the activity or the process is based on a multi-value variable. The activity is executed once for each value of the variable.
![]() |
When getting started with multi-instances, it is useful to create a simple process with one user activity first. This process will e.g. look like this:
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" targetNamespace="" exporter="d.velop process modeler"> <process id="multi_instance_process" name="Multi Instance Process" isExecutable="true"> <startEvent id="start" /> <userTask id="task_hello_world" name="Hello World" camunda:candidateUsers="${variables.get('dv_initiator')}" /> <endEvent id="end" /> <sequenceFlow id="s1" sourceRef="start" targetRef="task_hello_world" /> <sequenceFlow id="s2" sourceRef="task_hello_world" targetRef="end" /> </process> </definitions>
Adding a multi-instance
Add the BPMN item multiInstanceLoopCharacteristics to the user activity. Then change the variable which defines the recipient of the user activity to myPerformer.
... <process id="multi_instance_process" name="Multi Instance Process" isExecutable="true"> ... <userTask id="task_hello_world" name="Hello World" camunda:candidateUsers="${variables.get('myPerformer')}" > <multiInstanceLoopCharacteristics isSequential="false" camunda:collection="${variables.get('performers')}" camunda:elementVariable="myPerformer" /> </userTask> ... </process>
Explanation of the properties
isSequential: Use the value true to execute the activities sequentially and false to execute them simultaneously.
camunda:collection: Expression returning a multi-variable.
camunda:elementVariable: Variable name used locally for the respective value. A definition must be available for the variable.
In the sample process, an activity is sent for each value of the variable performers. The local variable myPerformer can be used to indicate that each individual item is a recipient.
In order to be able to use the variables performers and myPerformer, you need to define them. Add the BPMN items extensionElements and camunda:properties to the BPMN item process. To define the process variables, then add the item camunda:property to each of the BPMN items camunda:properties.
... <process id="multi_instance_process" name="Multi Instance Process" isExecutable="true"> <extensionElements> <camunda:properties> <camunda:property name="variable:performers*" value="[Identity]!" /> <camunda:property name="variable:myPerformer" value="Identity" /> </camunda:properties> </extensionElements> ... </process>
In order for the BPMN diagram to be displayed correctly in the modeling tool as well as the user interface, diagram information has been added. The final BPMN definition looks as follows:
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" targetNamespace="" exporter="d.velop process modeler"> <process id="multi_instance_process" name="Multi Instance Process" isExecutable="true"> <extensionElements> <camunda:properties> <camunda:property name="variable:performers*" value="[Identity]!" /> <camunda:property name="variable:myPerformer" value="Identity" /> </camunda:properties> </extensionElements> <startEvent id="start" /> <userTask id="task_hello_world" name="Hello World" camunda:candidateUsers="${variables.get('myPerformer')}" > <multiInstanceLoopCharacteristics isSequential="false" camunda:collection="${variables.get('performers')}" camunda:elementVariable="myPerformer" /> </userTask> <endEvent id="end" /> <sequenceFlow id="s1" sourceRef="start" targetRef="task_hello_world" /> <sequenceFlow id="s2" sourceRef="task_hello_world" targetRef="end" /> </process> <!-- Diagram information --> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="multi_instance_process"> <bpmndi:BPMNShape id="start_di" bpmnElement="start"> <dc:Bounds x="179" y="99" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="task_hello_world_di" bpmnElement="task_hello_world"> <dc:Bounds x="290" y="77" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="end_di" bpmnElement="end"> <dc:Bounds x="462" y="99" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="s1_di" bpmnElement="s1"> <di:waypoint x="215" y="117" /> <di:waypoint x="290" y="117" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="s2_di" bpmnElement="s2"> <di:waypoint x="390" y="117" /> <di:waypoint x="462" y="117" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </definitions>
You can now define the value of the variable performers e.g. for the start of the process.