Can you call Apex from process builder?

Can you call Apex from process builder?

Calling apex class from a Process builder is needed when complex logic has to be bundled in the form of an apex class and has to be automated as part of a process flow. To invoke an apex method you can use @InvocableMethod and follow the following steps: Invocable methods can have only one parameter.

What is an Invocable action in Salesforce?

The Invocable Actions mechanism allows developers to package useful code functionality into declarative building blocks that can be used by admins and other non-coding users in a growing range of Salesforce tools, including the Flow Builder, the forthcoming Next Best Action Strategy Builder, and more.

Where to find invocable methods in apex developer?

Public invocable methods can be referred to by flows and processes within the managed package. Global invocable methods can be referred to anywhere in the subscriber org. Only global invocable methods appear in Flow Builder and Process Builder in the subscriber org. For more information about invocable actions, see Actions Developer Guide.

How to use invocable method in process builder?

But you can call an @future method from withing the body of the Invocable method. @future @InvocableMethod (label=’label’ description=’description’) public static void inactivatePortalUsers (List ids) { } I did this just yesterday – so haven’t tested it thoroughly…..

How to create a custom apex class with invocable variable annotation?

Create a custom global or public Apex class to implement your data type, and make sure that your class contains at least one member variable with the invocable variable annotation. A list of a primitive data type or a list of lists of a primitive data type – the generic Object type is not supported.

How are invocable methods used in Salesforce flow?

If a flow invokes Apex, the running user must have the corresponding Apex class security set in their user profile or permission set. Invocable methods are called with REST API and used to invoke a single Apex method. Invocable methods have dynamic input and output values and support describe calls.