Lightning Components in Quick Actions

Lightning Components are the go to things in almost everything in Salesforce Development nowadays. There are so many things changed from Salesforce classic to Lightning. One of which is below :-

What has retired ?

Custom button on details page with open Visualforce or execute JavaScript.

What is the solution ?

Actions. With actions you can create a record, update record, Open Visualforce or Lightning Component and etc. While some us will think there is still Visualforce pages available in action, while some of us want to explore lightning.

Steps to use Lightning Component in Actions and other useful things

Create lightning component and add force:lightningQuickAction (this will have Cancel button by default) or force:lightningQuickActionWithoutHeader

<aura:component controller="RS_SearchPropertyCntrl" implements="force:lightningQuickAction,force:hasRecordId" >

To get the record id of the current object in the lightning component add force:hasRecordId

// This will give you record if which can be used to query or filter records
// In helper or controller

Closing action manually

var dismissActionPanel = $A.get("e.force:closeQuickAction");;

Showing a toast message

var toastEvent = $A.get("e.force:showToast");
 "title": "Success!",
 "message": "The records has been saved"

Refreshing the main view if required


Now just create the Action choose Lightning Component add action on the page layout and you are good to go..

Sample lightning component action which I created for providing general idea



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s