I am invoking an apex class in my flow, which returns List<List< String>> back to the main flow. The flow surprisingly doesn't let me store the returned value in a collection variable. Now I want to loop over the inner list of strings and display each value from the list as a line item on a screen, however, I do not have a collection variable to loop over. Please see the attached screenshots. Any help is much appreciated.
1 Answer
You've chosen the wrong combination of settings in your Apex Action element. You must either (a) create a new Collection from the Resource Manager, check the Manually assign variables, and then assign that Collection in the box below (that reads output in your first screen shot), or (b) uncheck the Manually assign variables checkbox, which will provide you with an automatically created collection called Text Collection from <Apex Action Name>. By using the Manually assign variables checkbox and leaving output blank, you're effectively discarding the results of the call.
When you uncheck Manually Assign Variables, you get the following Collection automatically:
You can then use this directly in a loop:
When you check the box, you must create your own:
List<List<String>>
in the first place?