Hi Daniel,
> Maybe we should think about allowing expressions / scripts for "aggregating" the results of multi instance?
While this might be a good idea for more advanced cases, I actually think there should be something more generic „out of the box“… a multi instance activity is meant to iterate over a collection of objects… hence we write e.g.
=> camunda:collection="${myService.resolveUsersForTask()}“
=> camunda:elementVariable=„assignee"
Now, with every object we can do something. Maybe we just want side effects, fair enough. But what if I want to „return" something back to the outer scope? What would that something normally be? I would argue: a collection of result objects. So I would actually expect to be able to write e.g.
=> camunda:resultVariable=„assigneeDocument“
=> camunda:resultCollection=„assigneeDocuments“
Inside every single execution of the multi instance I would be able (and expected) to actively set something into my resultVariable „assigneeDocument"… while the process engine then would take care of collecting these results into a new collection type variable „assigneeDocuments“ which can subsequently be seen by the surrounding scope. In case I need to aggregate that result now even more… I can actually just add a subsequent script task…
(In case this outer scope actually is a parent process, one needs to decide whether it would be necessary to declare the resultCollection as camunda:out, too, or not - I have no opinion about that right now)
Reasonable?
Feasible?
Martin.