Skip to main content The Trailblazer Community will be unavailable from 2/1/2025 to 2/2/2025. Please plan your activities accordingly.
(If should be posted to the developers forum I apologize - let me know and I'll post there instead.)

I can't set up my flow to receive a return value from an invocablemethod. :(

I'm building an Apex class named Temp that contains an invocablemethod named performApproval.  It returns a return code and string message through a custom object:

global without sharing class Temp {

@InvocableMethod

public static List<Apex_Result__c> performApproval(List<MyInvocableVariables> myVariablesList) {

List<Apex_Result__c> resultList = new List<Apex_Result__c>();

Apex_Result__c result = new Apex_Result__c();

result.Return_Code__c = 1;

result.Message__c = 'Testing';

resultList.Add(result);

return resultList;

}

global class MyInvocableVariables {

@InvocableVariable(label='Opp ID' required=true)

global Id oppID;

}

}

I call the method from a flow, and I defined an SObject collection variable named Results to receive the results of the call. However, when I attempt to specify that the method's output should go into that variable I only get the option to create a new variable:

Screenshot showing I only see Create New

Can anyone explain why I can't select an existing variable?  Even if I create a new variable it doesn't use it or allow me to select it.
2 answers
  1. Sep 8, 2017, 2:34 PM
    Hi,

    How are you doing to return resultList (line 10) which is a list whereas your fonction returns a list of list (line 3) ? 

    I would like do the same. My goal is to use an @InvocableMethod to pass a text as input and return a list of string as output.

    Thanks a lot for your help.
Loading
0/9000