lightning:quickActionAPI

In this blog I am going to show how to use lightning:quickActionAPI  component  that allows you to access methods for programmatically controlling quick actions on record pages. lightning:quickActionAPIcomponent is supported in Lightning Experience only. For Example, if you wanted to reuse the existing quick action across the different places like on the detail page or custom lightning component you can able to use lightning:quickActionAPI  to access the quick actions programmatically. To access the methods, create an instance of the lightning:quickActionAPI component inside your Lightning component or page and assign an aura:id attribute to it

In this example, I create a quick action that deactivates the Notification Opt-In Type from Active to inactive with configuration. Here is the simple quick action

Now you could be able to access that quick action programmatically by using lightning:quickActionAPI .

Here is the simple component I created for testing

The button call the following client-side controller.

Now I added the component to the lightning record page as shown below. On click of the Update Notification button, the javascript controller will call the quick action API and perform the update the based on the quick action.

Code Walkthrough 

  1. Below line will help javascript controller to find the Quick Action API

2.Set the target Fields with the values you wanted to update as shown below

3. Creta an arguments to pass it the quick action API method setActionFieldValues that allow custom components to select a quick action on a record pace and then specify field values for that action.

4. Use the invokeAction method that allows custom components to save or submit the quick action on a record page.