Newer Version Available
InvocableVariable Annotation
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.
The following code sample shows an invocable method with invocable variables.
InvocableVariable Modifiers
The invocable variable annotation has three available modifiers, as shown in this example.
@InvocableVariable(label='yourLabel' description='yourDescription' required=(true | false))
All modifiers are optional.
- label
- The label for the variable. The default is the variable name.
- description
- The description for the variable. The default is Null.
- required
- Whether the variable is required. If not specified, the default is false. The value is ignored for output variables.
InvocableVariable Considerations
- Other annotations can’t be used with the InvocableVariable annotation.
- Only global and public variables can be invocable variables.
- The invocable variable can’t be one of the following:
- A type such as an interface, class, or enum.
- A non-member variable such as a static or local variable.
- A property.
- A final variable.
- Protected or private.
- The data type of the invocable variable must be one of the following:
- For managed packages:
- Public invocable variables can be set in flows and processes within the same managed package.
- Global invocable variables can be set anywhere in the subscriber org. Only global invocable variables appear in the Cloud Flow Designer and Process Builder in the subscriber org.
For more information about invocable actions, see Force.com Actions Developer’s Guide.