Collecting results within for-loop steps
I have a flow - screenshot attached. It does multiple things inside a for-loop. I want to collect the results of the steps in the loop and return them as an array of objects from the overall flow. How do I do that? The final "result" step in the flow does not seem to be configurable. Maybe I need to add one additional step - just not sure what kind it should be to collect results.

6 Replies
@rubenf Is this doable? I thought maybe I could just stash the results iteratively - but its not clear where I could stash them. Unless this would require using setFlowUserState and then somehow at the end make the result be a call to getFlowUserState?
the default behavior of a forloop step is that its return is the array of the return of its steps
Understood ... but if I have 5 steps happening in a for loop and I want the result of each iteration to include results from each of the steps, how do I do that without requiring each step to take input of previous step and include that in its return?
For example, in our "pretend" mode - where we do all the processing but none of the database changing ... I want to get the output of step c in the final result. But all I get is an array of empty arrays for the number of iterations, even though each iteration of c is getting a result returned. Example of one of those also included.


you need the last step of the forloop subflow to collect the results you need
Ahhh ... so above the "Collect result of each iteration" I just add a simple Action script that collects the results in an object and return that.
yes