So, if I search for InvocableMethod there is a lot of documentation such as this:


And if I search for "pass record from Flow to Apex code" I see some examples like this:


But I can't find a single example that shows sending the main record from Flow to Apex. But I think this would be common?

Assume I have a Flow that is triggered on create or update for an Opportunity. So the Opportunity should be $Record? Assume I have written an Apex class with an InvocableMethod. It is clear, from the documentation, how to call this Apex code from the Flow, but it is not clear how I would specify that I want to pass the Opportunity record to the InvocableMethod. Can someone explain what I need to specify in the Flow?

1 Answer 1


Invocable method will only accept these parameters as input as per the article.

There can be at most one input parameter and its data type must be one of the following:

  1. A list of a primitive data type or a list of lists of a primitive data type – the generic Object type isn’t supported.

  2. A list of an sObject type or a list of lists of an sObject type.

  3. A list of the generic sObject type (List) or a list of lists of the generic sObject type (List<List>).

  4. A list of a user-defined type, containing variables of the supported types or user-defined Apex types, with the InvocableVariable annotation. Create a custom global or public Apex class to implement your data type, and make sure that your class contains at least one member variable with the invocable variable annotation.

In your scenario you can use List<Opportunity> as input parameter as below.

public class  senddatafromflowtoapex {
 @InvocableMethod (label = 'oppy flow' description = 'send oppy data to apex')
    public static void  senddata ( List<opportunity> opplist) {
        //logic here

In the flow you can just give $Record as a parameter as shown below.

enter image description here

  • Thank you. This is great. Mar 16, 2023 at 12:07

You must log in to answer this question.

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