@InvocableVariable in Apex is used when Flow invokes or calls the Apex Class and method.
Apex Class:
global class FlowController {
@InvocableMethod( label='Show Outputs' description='Getting multiple values' )
global static List < FlowOutput > showOutputs( List < FlowInput > inputs ) {
FlowInput objInput = inputs.get( 0 );
List < FlowOutput > outputs = new List < FlowOutput >();
FlowOutput objOutput = new FlowOutput();
objOutput.str3 = objInput.str1;
objOutput.str4 = objInput.str2;
outputs.add ( objOutput );
return outputs;
}
global class FlowInput {
@InvocableVariable
global String str1;
@InvocableVariable
global String str2;
}
global class FlowOutput {
@InvocableVariable
global String str3;
@InvocableVariable
global String str4;
}
}
Flow:
Invocable Variable Configuration:
Output: