In this tutorial, I am going to show you how to create Quick Action in Lightning Experience Salesforce. Quick Action is an object-specific that allows users to perform different actions like create records that have automatic relationships to other records, update specific records etc.

Create a Quick Action in Lightning Experience Salesforce:

Lightning Quick Actions is an object-specific that allows users to perform different actions like create records that have automatic relationships to other records, update specific records etc. The different Action Type that you can perform using Quick Actions are:

1- Create A Record:

This action type allows you to create records in Lightning Experience using its default functionality. You can add fields are per your requirement.

2- Log A Call:

It provides the default functionality for creating a task to log a call for the object on which you are creating Quick Action.

3  Custom Visualforce:

This action type allows you to add your own visualforce page to which the button will redirect. It is mandatory that the standard controller of the visualforce page should be the sobject for which the action is created.

3 Update Record:

Like “Create A Record” action type this action type allows you to update the specific record using its default functionality. Also, you can add fields according to your need.

4 Lightning Component:

You can add your own Lightning Component to which the will open as a pop-up on the button click. To enable a lighting component for Quick action, It must be implemented with one of the following interfaces:
force:lightningQuickAction
display standard header with save and cancel buttons on the Lightning Action Overlay Popup Modal
OR
force:lightningQuickActionWithoutHeader.
If you want to display Lightning component without header,

In this example, I am going to create a Quick Action that will open a Lightning Component as a popup.

Steps to add a Quick Action to an object:

The three steps that are required to add a Quick Action to object.

1- Create a Lightning Component.
2- Create a Quick Action Button.
3- Add Quick Action button on Page Layout.

Let’s complete this example step by step.

Step 1  Create a Lightning Component.

Login to your Salesforce account and open Developer Console. Goto File > New. Choose Lightning Component and enter the name of the name Lightning Component as LightningQuickActionExample.

Quick Action

Check Lightning Quick Action checkbox and click on the submit button. Write the following markup in your lightning component.

As you can see from the above markup the interface  force:lightningQuickAction is implemented in the component tag to enable this component for Quick Action.

STEP 2  CREATE A LIGHTNING COMPONENT.

1- Switch to Lightning Experience

2- Goto Setup as shown in the image.

Quick Action

3- Go to  Objects and Fields > Object Manager

Quick Action

3- Select an object in which you want to add lightning action (In my case I choose Account object)

4- Go to Buttons, Links and Actions section.

5- Click on the New Action button as shown in the below image.

Quick Action

6- Fill the details and select the Lightning Component that you have created in Step 1. Click on the Save button.

Quick Action

Now we are done with Step 3. Let’s jump to Step 3 which is adding Quick Action to Page Layout.

Step 3 Add Quick Action button on Page Layout:

1- Go to Setup > Objects and Fields > Object Manager > Select the Object ( Account ) > Go to Page Layouts section Go to Setup > Objects and Fields > Object Manager > Select the Object ( Account ) > Go to Page Layouts section. Select Account Layout.

Quick Action

2- After selecting the layout Go to Salesforce1 and Lightning Experience Actions section and Drag your Quick Action button to the layout.

Quick Action

3- Save the changes.

4- Goto Account Record Page and Click on the Quick Action button as shown

Quick Action

Output:

Quick Action

View More:

Conclusion:

I hope you would love this post. Please don’t hesitate to comment for any technical help. Your feedback and suggestions are important for us.

Thank You.

Leave a Comment