accessing the return value of an InvocableMethod in process builder
I dont think we can access the return value in Process Builder .Process Builder just takes record on which an action is invoked and uses as parameter to InvocableMethod and process logic .
The return values from Invocable methods makes sense for flows and REST API .Return values can be fed back to flows as variables .
If the return type is not Null, the data type returned by the method must be one of the following:
- A list of a primitive data type or a list of lists of a primitive data type – the generic Object type is not supported.
- A list of an sObject type or a list of lists of an sObject type – the generic sObject type is not supported.
- A list of a user-defined type, containing variables of the supported types and with the InvocableVariable annotation.
Create a custom global or public Apex class to implement your data type, and make sure your class contains at least one member variable with the invocable variable annotation. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_InvocableMethod.htm