UPDATE!!! This is information is outdated. GO HERE.
Invocable methods used with Flow allow you to launch something in an admin friendly format that uses the massive power of Apex. For example, you have an intake screen that collects answers to a few questions, then you use Apex to loop through many related records dispersing those answers in places hard to reach from Flow.
Creating an invocable method in a nutshell: First you write an apex class with @invocable method (label and description) and whatever code you want the apex to do (easy, right?) Then make your Flow including your input and output variables. Then add an Apex action in Flow to send/receive those variables.
Here are some things I learned about sending data between Flow and Apex.
Invocable methods in Apex always receive a List and they return a List unless the return type is null. Read more under “Inputs and Outputs” here.
| Sent | Sent From | Received by | Received |
| Record Variable.id | Flow | Apex | List<Id> listOfIds |
| Record Collection Variable | Flow | Apex | List<List<Opportunity>> nameOfThis |
| List containing 1 sObject record | Apex | Flow | Record (single) variable |
| List of Lists of sObject | Apex | Flow | Record Collection Variable |
This is NOT an exhaustive list at all. I didn’t try sending a record variable (not just the ID from Flow), but I assume that will work. There are also generic sObjects that are pretty special, but I didn’t try.
Continue reading Invocable Methods: How to Send Data Between Flow and Apex








