I'm using an apex action to obtain, from a recordId (which is the input variable that is sent from the flow into apex), the name of the object to which it belongs (objectname). I want to send this variable back into the flow as an input variable, but I'm not sure how to do it.
Here's my code at the moment - after the method which obtains the name of the object, I have created another class called "FlowOutputs" that includes an @InvocableVariable objectname. However, I suspect that the variable is not being sent from the method to the "FlowOutputs" class.
Here is my code:
public class GetObjectNameFromRecordId {
public class FlowInputs{
@InvocableVariable public String recordId;
}
@InvocableMethod public static void GetObjectNameFromRecordId(List<FlowInputs> ParameterList){
Id recordId2getobject = ParameterList[0].recordId;
String objectname = recordId2getobject.getSObjectType().getDescribe().getName();
}
public class FlowOutputs{
@InvocableVariable public String objectname;
}
}
I want to be able to see this option in the Action, in order to store the output value (in my case the object name):
Thanks very much!