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.
In this blog post, I am going to explain salesforce action. Actions enable users to do more in Salesforce and in Salesforce1, the Lightning experience depends on the chatter settings. You can create an action and add them to the Chatter publisher on the home page, on the Chatter tab, in Chatter groups, and on record detail pages. In Salesforce Classic, actions appear in the Chatter publisher. In Lightning Experience, actions appear in different areas of the user interface, depending on the action’s type. In Salesforce1, actions appear in the action bar, its associated action menu, and as list-item actions.
Actions have the different type of categories
Standard actions are actions that are included automatically when Chatter is enabled: Post, File, Link, Poll, and, in organizations that use work.com, Thanks, Announcements are default actions.
Default actions are Salesforce predefined actions to get you and your users started using actions in your organization. Add default actions to publisher layouts to make them available to your users in the full Salesforce site and the action bar in Salesforce1.
Mobile smart actions
Mobile smart actions are a set of preconfigured actions, just like default actions, and are supported on the same list of objects. However, they appear in pre-Winter ’14 organizations and are displayed only in Salesforce1.Mobile smart actions are populated with all your organization’s required fields on the relevant object, regardless of how many fields there are.Mobile smart actions don’t appear in the full Salesforce site, regardless of which page layouts you add them to; they appear only to users in Salesforce1.
Custom actions are actions that you create and customize yourself, such as Create a Record, Send Email, or Log a Call actions. They can also invoke Lightning components, Visualforce pages, or canvas apps with functionality that you define.
Productivity actions are predefined by Salesforce and are attached to a limited set of objects. You can’t edit or delete productivity actions.The actions include Send Email, Log a Call, Map, View Website, and Read News.
Type of Actions
Within the categories of actions, you can have different types of actions, depending on their function.
Create actions let users create records.
Send email actions available only on cases, give users access to a simplified version of the Case Feed Email action on Salesforce1
Log call actions let users record the details of phone calls or other customer interactions.
Question actions enable users to ask and search for questions about the records that they’re working with.
Update actions users make changes to a record.
Steps to define Quick action
Now it’s time to define the quick action. defining quick action contains the below steps.
Enable Actions in the Chatter Publisher
Enable feed tracking for the objects for which you want to make actions available.
Enable actions in the publisher if you want to see both standard actions and non-standard actions in the Chatter publisher.
Optionally, enable feed updates for related records to display feed items on a record detail page when related records are created.
Create object-specific actions or global actions.
Customize the action layout with the fields that you want users to see when they use the action.
Add the actions to page layouts or global publisher layouts.
1. Global Actions
Let’s create a global action that allows users to create an order from chatter.Global actions let users do tasks such as creating records or recording call details directly from the publisher on the Home tab, the Chatter tab, the action bar on the Salesforce1 feed, and Chatter groups. You can also add global create actions to record detail pages. Global actions enable users to create object records, but the new record has no relationship with other records.
From Setup, enter Actions in the Quick Find box, then select Global Actions.
Click New Action.
For Action Type, leave Create a Record selected.
For Target Object, select Order.
Enter Label as “New Order”
On Success Message Enter “Order is successfully created “
After click on Save page will redirect to action layout which allows users to customize action layouts as shown below. action layouts are similar to page layout where you can add fields to layouts. add the fields as shown below and click on save.
Predefined field values
Predefined field values will populate the values with predefined values on the action. Setting up predefined values for certain fields on actions can increase your mobile users. Go to global action New Order which we created. you can see related predefined values.In the Predefined Field Values related list, click New and add fields as shown below.
Adding to Global Publisher Layout
Global publisher layouts determine which actions appear in the publisher in various pages throughout Salesforce, including the Home tab, Chatter tab, and Chatter group detail pages in the full site, as well as the action bar and action menu in Salesforce1. Global publisher layouts can include only global actions. Go to publisher layout edit and add the global action as shown below
Now you can able to see global action on chatter feed as shown below
2. Object-Specific Quick Actions
Object-specific actions let users quickly create or update records, log calls, send emails, and more, in the context of a particular object.You create object-specific actions in the context of the object. object-specific create actions create records that are automatically associated with related records. For example, you add an object-specific action on the Account object that creates contacts. If a user creates a contact with that action on the detail page for the Acme account, that new contact is automatically associated with Acme.Object-specific update actions make it easy for users to edit records. You can define the fields that are available for update.Let’s assume that you wanted to create a Competitor from the account feed. We are going to create a quick action on the account.
Create an Object-Specific Action
Go to Account Object -> go to Buttons, Links, and Actions and click New Action and create an Action as shown below
Add an Action to Account Page Layout
After creating an action you need to add to the page layout to appear in the feed. Go to Account Page and add the action as shown below.Finally, you can see the Action on feed as shown below.