Hi,
I am designing a process that includes a callActivity component with a loop, where the loop is sequential. Upon completion of each execution of the inner activity, a variable is added to the same process.
Now, I want to make that variable accessible to the outer process. Additionally, through an execution listener at the end of the callActivity, I want to sum up the results of all iterations into another variable.
When I am adding the out parameter to the call activity with looping, it is not visible in the execution listener as well in the db table.
Is there any property available to get all the data from loop. In Activiti, there is one property we can use to collect all the results from the loop iterations.
processDataList
But the problem here is it collects all the local variables of the iteration execution entity. So, i am not sure how to set all variables from child process to the loop iteration execution entity.
Because of this, I am getting a list of empty maps.
I am not sure how we can use this concept to achieve our goal.
In the subprocess that you’re calling via the Call Activity, you can keep a list of whatever you want in the process variable context that you can populate on each iteration and overwrite it at the end of the subprocess with the updated list. That way, you can return that variable as an output from the call task and it will have all of your aggregated data in it. (Could also be done with other collections, eg. maps.)
What I understood from your answer, is to add a loop on subprocess instead on the call Activity.
Am I right?
As per my requirement, I want to add a loop on call Activity and completion of each iteration of the call activity, I need a particular variable to be added in the list from child process to the parent process.
Here problem is that, out parameters and looping on call activity are not working with each other.
No, the call activity calls another process, which I was referring to as the subprocess. The multi-instance loop on the call activity is the correct way to loop.
Basically what I mean is that you set up the multi-instance loop on your call activity. You also have an output which would be the name of your list from the process being called (ie. subprocess) by your call activity.
Within the called process (ie. subprocess), you would ideally have a service task that did some work, or perhaps you do all your work in the business process, but could then have a service task or script task that would read whatever variables you need to build your list item, read the list from the variable map, build that iteration’s object and add to the list, then complete the task with a map containing just your updated list with the same variable name. It will overwrite what is in your local variable map for that process iteration, containing what was in the variable when read in plus the added item.
Apparently for multi-instance loops on call activities, it will keep up with your variables from each instance, or at least the ones specified in the Out Mappings section.
For example, in this image of the configuration of a Call Activity, the loop is being set to iterate over autoRemandClaimsToProcess. All in mappings from the caller are propagated to the called activity (this may be part of how the out mappings are persisted for each loop iteration?) and the out mappings are remandClaims and remandDecisionReviews. In the called process, there is a service task that updates the remandClaims and remandDecisionReviews task with those items that were produced for each iteration, and that compiled list is available to the caller once all loop iterations are complete.
Also wanted to show the Out Mappings details. Pretty straightforward. Just reading the variables as they are named in the child process (Source) and naming them the same in the parent (Target).