Created attachment 922437 [details]
 git repository
Description of problem:
Let's my Multi-Instance sub process is iterating over List<Person> and I am storing the element of the current iteration in the variable called 'myPerson'.
In multi-instance sub process, there will be new process created, which will include Human Task with the Data Input which will be mapped by 'myPerson'.
When you change whatever value of this object it will be updated once the Human Task is completed.
However, when the the whole multi-instance sub process will be completed (after all sub processes are completed) the updated value is lost and we are back to the 'original' value.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Clone the git repository, build the project
2. In CustChildApproval process you need to change "actor" value of the Human Task
3. Build the project
4. Start the InvoiceProcessing-CustomerName process
5. Fill in the following input field 'ccOwners (_Application)' with the comma separated list of values, for example "actor1,actor2,actor3"
-- size of the list will determine number of instance of the the multi-instance sub process
6. Complete *all* human tasks, and in each, change the value of ccOwner, for example, from actor1 to actor1-changed
7. Observe the output
Element of the iteration of multi-instance sub process is not updated once the multi-instance sub process joins the main process execution
Element of the iteration of multi-instance sub process is updated.
This may be related to the https://bugzilla.redhat.com/show_bug.cgi?id=1123855
As the assignment section of the reusable sub process in the multi-instance subprocess was created using 'hacks'.
I can observe the following output:
//these are the original values
08:45:32,738 INFO [stdout] (http-localhost/127.0.0.1:8080-14) CC Owners: anton1,anton2,anton3
//these are the values outputted from the On Exit Actions from the ReUsable sub process, which is part of the MultiInstance sub process
08:46:06,851 INFO [stdout] (http-localhost/127.0.0.1:8080-11) *** Cost Centre [ccOwner: anton1-changed, status: ]
08:46:22,356 INFO [stdout] (http-localhost/127.0.0.1:8080-11) *** Cost Centre [ccOwner: anton2-changed, status: ]
08:46:32,768 INFO [stdout] (http-localhost/127.0.0.1:8080-19) *** Cost Centre [ccOwner: anton3-changed, status: ]
But then it seems like to mapping back to the process variable does not work
//these are the values outputted from the script task which is executed once the multi-instance sub process completed
08:46:32,771 INFO [stdout] (http-localhost/127.0.0.1:8080-19) Aggregating responses...
08:46:32,772 INFO [stdout] (http-localhost/127.0.0.1:8080-19) *** Invoice Remark of [ccOwner: anton1, status: null]
08:46:32,772 INFO [stdout] (http-localhost/127.0.0.1:8080-19) *** Invoice Remark of [ccOwner: anton2, status: null]
08:46:32,772 INFO [stdout] (http-localhost/127.0.0.1:8080-19) *** Invoice Remark of [ccOwner: anton3, status: null]
The problem here is actually with process definition itself as to be able to update process level variable (remarks) multi instance output needs to be defined. While working with this case it turned out that designer is missing possibility to define that output variable for multi instance subprocess (while it's available as multi instance on a task).
Note: when working with multi instance a good practice is to distinguish between input and output on process variable level so I suggest to include:
- multi instance input as remarks
- multi instance output as remarksOut
even though engine will process if both input and output will be referencing same variable but it will add elements to it so in the end both input and output elements will be stored in that collection.
So depending on the requirements I see two workarounds until support for output of multi instance on subprocess will be added:
1. use regular task with multi instance capabilities e.g. user task as it allows to define input and output of multi instance
2. make manually modification to the bpmn2 to include required output elements (see attached process that has all the pieces available) - please note that when modifying the bpmn2 manually it won't be editable in designer although it will be executable
so for the second workaround user would need to use git integration to push process (parent process) to business central and then directly build and deploy it.
Created attachment 923234 [details]
Updated parent process with output of multi instance
Created attachment 923302 [details]
Verified on BPMS 6.0.3 ER1
I am also changing component to jBPM Designer, because the previous one (jBPM Core) might be confusing for us in the future.