2

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.

enter image description here

Here you can see that I create a test non-collection Text variable, which is visible, but the Args collection Text variable is not:

enter image description here

How do I pass a List<String> into the Apex Action when I cannot select a collection variable as an input argument?

2

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...

A list of a primitive data type or a list of lists of a primitive data type – the generic Object type is not supported.

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 use List<String>.

  • That was the problem. Thank you as always. – Swisher Sweet Apr 15 at 22:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.