How do you call an Apex class in flow?

How do you call an Apex class in flow?

The invoked method is the method that is called by the Apex Action in the Flow.

  1. The @InvocableMethod annotation allows the Flow to call the method.
  2. Use the ‘label’ attribute to define the display name of the Apex Action.
  3. It can have only one parameter.
  4. You can have only one invocable method per class.

Can we call Apex class 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.

How do I return a list in Apex?

The Apex class must have a public static method called ‘generateStringArray’. The ‘generateStringArray’ method must return an array (or list) of strings. Each string must have a value in the format ‘Test n’ where n is the index of the current string in the array.

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 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.

What do you need to know about invocablemethod in flow builder?

If you don’t specify this modifier, Flow Builder uses the standard property editor. The invocable method must be static and public or global, and its class must be an outer class. Only one method in a class can have the InvocableMethod annotation. Other annotations can’t be used with the InvocableMethod annotation.

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.

https://www.youtube.com/watch?v=FJehYPnAc_w