How to dynamic create muti instance activity

hi all.
the bussiness back ground is, when i order a list of goods to manufactory, the facttory may send goods to me multi times(the num is dynamic unsure), each time i need to complete two task: “confirm arrive”, “check in to warehouse”.

these two task need to run multiple time. What i need is when 1st task complete , then 2nd task will availe active, and a new 1st task will availe active. if the 2nd task is too slow, it should not block the 1st task.

  1. if i place in sequence sub proc, if 2nd task is not complete , then new 1st task will not avail active.

  2. if i place in paralle sub proc, if loop cardinality=100, the engine will staticlly create 100 avail active 1st task when init.

  3. if i place in two sequence multi ins task, when 1st not all complete, the 2nd will not be avail active.

how to model it?

@thinkdoom refer the below example which might help you.

hi, @aravindhrs

though Element Variable is dynamic , but before initialize the “multi ins act”, it’s still need with clear-defined lengh and values.

what i met here is before initialize the “multi ins act”, i don’t know how many ins is needed.

@thinkdoom you don’t need to know number of values, multi-instance feature has the capability to work on dynamic collection. Just pass the collection resultset to the property like:


usersList is collection variable which has dynamic values. Then assign a element variable to loop through the collection like below:


Multi-instance activity looks like for dynamic values are:

    <bpmn:userTask id="Activity_1dh2ktb" name="Do Vote" camunda:asyncBefore="true" camunda:assignee="${user}">
          <camunda:formField id="approved" label="Do Vote" type="boolean" defaultValue="false" />
        <camunda:taskListener delegateExpression="${voteRegisterListener}" event="complete" />
      <bpmn:multiInstanceLoopCharacteristics camunda:asyncBefore="true" camunda:collection="${usersList}" camunda:elementVariable="user" />

hi @aravindhrs, dose it mean:

If i start a proces instance A.

  1. before i enter multiins_subproc, i set usersList={4,5}, it will create two multiins_subproc, 1st with user=4, 2nd with user=5.
  2. then i didn’t complete the two multiins_subproc.
  3. i receive a new arrive task(real dynamic, and can’t predicte when arrive new goods, and how many arrive this time, total 100 may be this time arrive 5 or arrive 41), set usersList={4,5,6} in another thread dynamiclly.
  4. it will create 3rd with user=6
  5. ultimatlly, now there are 3 act multiins_subproc.

the above description is what i expect.