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