You are here:
Call Apex Code from a Process
Add customized functionality to your process by calling Apex from the process.
Required Editions
| Available in: both Salesforce Classic (not available in all orgs) and Lightning Experience |
| Available in: Enterprise, Performance, Unlimited, and Developer Editions |
| User Permissions Needed | |
|---|---|
| To create, edit, or view processes: | Manage Flow AND View All Data |
After December 31, 2025, existing processes continue to run, and you can activate, deactivate, and edit them; however, we recommend using Flow Builder. To migrate existing processes, plan your switch to Flow Builder and use the Migrate to Flow tool. For new automations, create flows in Flow Builder.
After you’ve created an action and selected “Apex” for the type, fill in the relevant fields to add the action to your process.
@InvocableMethod. For
details, see “InvocableMethod Annotation” in the
Apex Developer Guide.The Apex class and the process are executed by the user whose action triggered the process.
- Enter a name for this action. This text appears on the canvas and helps you differentiate this action from others in your process. The name truncates to fit on the canvas.
- Choose an Apex class by entering the name of the class to filter results or select a class from the dropdown list.
- If the class includes an invocable variable, you can manually enter values or reference
field values from a related record.
The value must match the variable’s data type. You can set values for sObject and primitive type list variables only.
- To set values for sObject variables and sObject list values, reference an object’s related records, for example, all child contact records associated with the Account object that started the process.
- To set a value for a primitive list variable (String, Integer, Time, and so on), select the String value type and enter a value in the text input field. You can’t pass multiple values to lists.
- Click Save.
Note If you define an Apex action in your process and then modify the Apex class by adding a standard field reference (for example, User.Phone), the Apex action is no longer visible in the process and must be added again.

