1

The documentation on invocableMethod clearly states that you can pass in a list of a sObject type.

There can be at most one input parameter and its data type must be one of the following: A list of a primitive data type or a list of lists of a primitive data type – the generic Object type is not supported. A list of an sObject type or a list of lists of an sObject type – the generic sObject type is not supported.

However, in my flow, i only have the option to pass in a sObject variable - there is no option to pass in a sObject collection (I have a sObject collection set to public input / output in the flow).

optionsInFlowApexElement

So how can you pass a list of a sObject type from flow to invocable method? Seems like you can only pass a single sObject.

2 Answers 2

1

Found answer on developer boards from Chad Barbour.

If the expectation is to receive a collection you can use in the flow, you'll need to have your method return a collection of collections. In this case, if you're wanting a list of strings (List), you'll want to have it return a list containing lists of strings (List>).

Apparently a sObject variable is a list, and a sObject collection is a list of lists. So you need to be able to work with lists of lists and then you will have the option to pass / receive sObject collections. Go figure...

1
0

In your invocable method, set the incoming parameter to a list of lists of your object type. Ex: List<List<Leads>>, save the class and reload Flow to see if you can pass in a collection. I also asked a similar question that has code showing invocable variables here. I was able to pass in collections once I used invokable variables to communicate with flow.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .