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.
Solved! Go to Solution.
I've fixed the problem with not finding the variable in called activity. I'd hadn't mapped the elementVariable in the input parameters.
It's still strange that the service to create the collection seems to run multiple times.
I've fixed the problem with not finding the variable in called activity. I'd hadn't mapped the elementVariable in the input parameters.
It's still strange that the service to create the collection seems to run multiple times.
The running multiple times may be transaction roll back and retries. I've just been working on a similar problem where I haven't set process variables correctly. I just see my service task run and fail 3 times 10 seconds apart. I assume a rollback is occurring then the transaction is retried. No error is shown presumably as the exception isn't caught.
In your case you have 2 sub processes, so it could be the same behaviour, if each fails and retries 3 times that gives 6.
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.