Is there any documentation available related to
@InvocationMethod
annotation of APEX (Spring 15 feature)? I’ve been going through the release notes –http://releasenotes.docs.salesforce.com/spring15/spring15/release-notes/rn_forcecom_flow_apex.htm
But to me it seems that we can pass Any Datatype into a method identified as
@InvocationMethod
, and it can accept Any number of parameters, but while I try to savea method with 2 parameters it returns following error:Compile Error: Only one parameter is supported on invocable methods
Also, it only accepts List datatype parameter and only returns list type variable as well. is this a known Limitation or an Issue as well (and not documented anywhere) ?
Answer
While you can only pass one variable to @invocationmethod
, you can use @invocablevariable
in your custom class instead to permit multiple input variables from Process Builder.
Use the InvocableVariable annotation to identify variables used by invocable methods in custom classes.
The InvocableVariable annotation identifies a class variable used as an input or output parameter for an InvocableMethod method’s invocable action. If you create your own custom class to use as the input or output to an invocable method, you can annotate individual class member variables to make them available to the method.
Attribution
Source : Link , Question Author : VarunC , Answer Author : Community