My issue here is that on the completion of the Multi-Instance Subprocess (the bottom Pool which is called by the Parallel Multi-Instance Call Activity), my created (via camForm function) json variable (“selectedProduct”) keeps only the submitted values from the last completed instance.
Does anyone know please how can I update (by appending each time the new submitted values) this json variable each time an instance is completed in the Subprocess ?
A multi-instance activity ends when all instances are finished.
That means, that all the subprocesses are executed before the process gets to your last task. And the problem you are having is, that every subprocess of your multi-instance writes the output to the same result variable. So this variable gets constantly overwritten and only contains the result of the last iteration.
So you should consider creating an object that holds all the results of the subprocesses.
Here is a good forum post that helped me to improve the usage of my multi-instance tasks:
I suggest you implement it similar to this example and collect the results of your multi-instance-tasks after avery instance on your own.
On the completion of the 1st task in the Main Process (Create a List of Products), a json array variable (“product”) is created via camForm function inside an html form and 6 instances of the task in the Subprocess (Select Products from the List) are created and assigned to 6 users.
On the completion of the task in the Subprocess (“Select Products from the List”), a new json array variable (“selectedProduct”) is created via camForm function inside an other html form.
What I want to achieve here is to append the submitted values to this json variable (“selectedProduct”) each time an instance of the task (“Select Products from the List”) is completed. Now, when I complete the Multi-Instance Subprocess, this json variable (“selectedProduct”) keeps only the submitted values of the last completed instance.