Dynamic Actions in Lightning with Example

Salesforce has introduced a new way to add actions on Lightning Record Page. This can be done with Dynamic Actions in Salesforce. Dynamic Actions allow more control and flexibility to the actions on Lightning Record Pages.

In this post, we will implement Dynamic Actions in Lightning with an example.

Dynamic Actions in Lightning

Before the implementation, let’s see why Dynamic Actions in Salesforce is the future of Actions on Lightning Record Pages.

  • It allows you to add Standard Actions on Lightning Record Page.
  • It allows you to add Custom Actions along with Quick Action, Global Quick Action on Lightning Record Pages.
  • Provides the flexibility to show actions based on Record Criteria, Form Factor.
  • Also supports criteria based on Users, Profiles, Roles, Custom Permissions, etc.

Now that we have seen the features, let’s get into the implementation.

Implementation

Dynamic Actions can be set up using Lightning App Builder. In this demonstration, we will update the Record Page of a Custom Object. Edit the Lightning Record Page from Setup -> Edit to get into the Lightning App Builder.

Once we are in the Lightning App Builder, click on the Highlights Panel. If you are doing this for the first time on that page, you will see something like this:

Upgrade to Dynamic Actions
Upgrade to Dynamic Actions

We just need to click on Upgrade Now under Upgrade to Dynamic Actions. A form will pop up that will ask to choose either Migrate or Start from Scratch. With the help of Migrate, we can migrate the actions from the existing page layout. For this demonstration, we will select Start from Scratch. Click on Start from the Scratch.

Migrate or Start from Scratch
Migrate or Start from Scratch

Now, we just need to click on the Add Action button to add the actions. Select the Action from Search Actions. You will be able to see Standard Action, Quick Action, and Global Actions (both Standard and Custom).

Add Dynamic Actions on Lightning Record Page

First, click on Add Action and select Edit action and click on Done. You can also see the Add Filter button under Set Action Visibility. If you click on Add Filter, you should be able to see multiple options like Record Field, Device, and Advanced.

Filters in Dynamic Actions
Filters in Dynamic Actions

Record Field is used to provide the criteria based on the value of fields. The Device criteria allow you to select either Desktop or Mobile. Advanced allows us to add more criteria based on Users, Custom Permission, etc.

Click on Add Action again and select Delete action. Let’s say we want to show the Delete button to Administrators only. In that case, click on Add Filter -> Advanced -> Users and select the Profile Name and provide the name of the Profile. This Delete action will be visible to only that particular Profile only.

If you have any custom actions created, those will also be visible to add as Dynamic Actions in Lightning. I have added one Quick action as well to allow users to create an Account record.

We can provide value in Visible Action Buttons (desktop only) to display few Actions visible directly on the Page. The rest of them will be visible after clicking the drop-down icon from Highlights Panel. We can also easily re-arrange the Actions from Dynamic Actions. The Actions which has filters enabled will have an orange filter icon to differentiate between the actions.

Dynamic Actions in Salesforce
Dynamic Actions in Salesforce

And this is how our Dynamic Actions in Salesforce will look on the Lightning Record Page.

Dynamic Actions in Lightning
Dynamic Actions in Lightning

Also Read:

Considerations

  • Dynamic Actions for custom objects are generally available for Desktop and in beta for Mobile.
  • Dynamic actions for standard objects are in Beta for desktop. And it is only available for limited Standard Objects.

That is all from this post. If you don’t want to miss new implementations, please Subscribe here.

If you want to know more about Dynamic Actions in Lightning, check official Salesforce documentation here.

See you in the next implementation, Thank you!

Leave a Comment