AnsweredAssumed Answered

strange multi instance activity behaviour

Question asked by navitect on Sep 26, 2018
Latest reply on Dec 6, 2018 by pault

I'm noticing some strange behaviour with multi instance process.

 

My original need was to create a multi instance call activity, as follows:

 

<callActivity id="callactivity1" name="Call activity" calledElement="testCalledProcess">
   <multiInstanceLoopCharacteristics isSequential="false" activiti:collection="${myList.getList()}" activiti:elementVariable="myVar"></multiInstanceLoopCharacteristics>
</callActivity>

 

When I try to lookup the process variable myVar in the sub-process I can't find it.

Also, I saw that myList.getList() is being run multiple times. The list has only two entries in it, but from a println in getList() it seems to be run about six times! The correct number of sub-processes (2) is created.

 

I therefore tried a test with a script task

<scriptTask id="scripttask1" name="Script Task" scriptFormat="javascript" activiti:autoStoreVariables="false">
<multiInstanceLoopCharacteristics isSequential="false" activiti:collection="${myList.getList()}" activiti:elementVariable="myLetter"></multiInstanceLoopCharacteristics>
<script>java.lang.System.out.println("Letter "+myLetter)</script>
</scriptTask>

I found the same behaviour with multiple executions of getList(). i.e. six times. However the variable myLetter is passed and correctly printed correctly. Only two instances of the task are created.

Outcomes