Newer Version Available
InvocableVariable Annotation
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.
The following code sample shows an invocable method with invocable variables that have the generic sObject data type.
InvocableVariable Modifiers
The invocable variable annotation supports the modifiers shown in this example.
@InvocableVariable(label='yourLabel' description='yourDescription' required=(true | false))
- label
- The label for the variable. The default is the variable name.
- description
- The description for the variable. The default is Null.
- required
- Specifies 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 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:
- A primitive
- An sObject, either the generic sObject or a specific sObject
- A list or a list of lists of primitives, sObjects, objects created from Apex classes, or collections
- 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 Flow Builder and Process Builder in the subscriber org.
For more information about invocable actions, see Actions Developer’s Guide.