Flow Invocable Actions

In this post, I will show how to use the flow Invocable Action… Actions are easy to discover and use, and also easy to understand and implement. Every button and link in Salesforce can be considered an action. A consistent Actions API and framework support the creation and distributed use of actions throughout Salesforce. Actions are available in the REST API. Invocable actions, also known as dynamic actions, can be invoked from a common endpoint in the REST API. Here we will be creating a flow and calling the flow using the REST API. The example we are taking here is returning the order and order lines items based on the order name from the auto-launched flow.

1. Create a flow 

now create a flow that will take the input argument from the rest API and return query order and order line items based on the order name.now from the flow designer create a new input variable that will collect the order name.


Drag and drop the fast lookup on the flow builder and Lookup the order name by passing the Order name from the inputVariable created above

OrderResult is sobject variable and adds the following fields

Now drag and drop one more Fast lookup now to query the order line items and this time we will assign the value to result variable to sobject collections.

Orderlines in the sobject collection type and return the following fields.

Connect the two fast lookups as shown below

Now save the flow of type Auto launched Flow as shown below

2. Calling Flow Actions

Now you will be able to call the flow from the invocable flow actions. Now you need to use the custom flow actions rest URI

Invokes the OrderAPIService flow

You will be able to execute the REST API from the workbench. Go to the salesforce workbench and execute the rest API as shown below

After executing the flow action, you can able to see the result as shown below

Understanding Input and Output

        Input values vary according to the input variables specified for each flow. For autolaunched flows, the input values vary according to the input variables in that flow. In this example the input variable is OrderNumber Invocable processes always require either one of the following input parameters:

  • sObjectId: The Id of the sObject record that you want the process to execute on. The record must be of the same object type as the one on which the process is defined.
  • sObject: The sObject itself that you want the process to execute on. The sObject must be of the same object type as the one on which the process is defined.

Output values vary according to the output variables specified
Flow__InterviewStatus is available for flows. Invocable processes do not have outputs. In the response, you can able to see the Flow__InterviewStatus as finished.