I have a simple screen flow, which takes in a case Cancel Reason, and if that reason is Other, will get allow a user to specify the other reason via text entry.
We have an Apex server method called CancelCaseInvocable
, which calls common case cancelation logic shared by other code.
I can see the Apex @InvocableMethod
and it provides a place to specify the input and output values. The actual server method takes a List<String>
and returns the same.
I have created a local flow variable called Args
, which is a text collection variable. I have added the necessary args to the variable but when I try to select the variable in the Cancel Case
Apex Action, I do not see the Args
variable.
Here you can see that I create a test
non-collection Text variable, which is visible, but the Args
collection Text variable is not:
How do I pass a List<String>
into the Apex Action when I cannot select a collection variable as an input argument?
Best Answer
The InvocableMethod interface is bulkified. This allows you to map flows within Process Builder in a bulkified manner. As the documentation states, your parameter must be...
This means that to pass in a collection, you actually need to use
List<List<String>>
(or whichever other type you need), and to pass in a normal variable, you need to useList<String>
.