[SalesForce] How – Call invocable Apex class that returns me a list of ids, in flow builder

I have an invocable Apex class that returns me a list of ids. But when I create an apex action at the level of my flow builder, I cannot store the list in a collection variable, it just offers me a simple variable.
and my need is to retrieve this list of id and apply a loop on this list in my flow.

Best Answer

The InvocableMethod annotation is designed to handle Flows in bulk (e.g. Process Builder automations). To return a simple variable, you need to return a list, to assign to a collection, you must return a list of lists (e.g. List<List<Id>>). The size of the returned list must match the size of the input parameter list.