Lightning Quick Action and Salesforce Classic Publisher JavaScript APIs

Use the lightning:quickActionAPI component in your custom components to interact with quick actions on the page. The component calls the Lightning Quick Action JavaScript API methods and provides similar functionality to the Salesforce Classic Publisher JavaScript APIs, also known as the Case Feed Publisher APIs. If you used the Salesforce Classic Publisher JavaScript APIs, your Visualforce components and pages now work automatically in Lightning Experience. No need to rewrite your code.

Where: This change applies to Lightning Experience and Salesforce Classic in Group, Professional, Enterprise, Performance, Unlimited, and Developer editions.

How: There are a few differences between the Salesforce Classic Publisher JavaScript APIs and the new Lightning Quick Action JavaScript APIs.

Different How? Salesforce Classic Publisher JavaScript APIs Lightning Quick Action JavaScript APIs
Implementation

To implement, load the publisher script in your Visualforce page or component. For example:

<script
type='text/javascript'
src='/canvas/sdk/js/43.0/publisher.js'
/>

Then you can reference the Publisher APIs through the Sfdc.canvas.publisher object. For example:

Sfdc.canvas.publisher.selectAction({...})

To implement, use the component lightning:quickActionAPI in your custom Lightning component. For example:

<aura:component
implements="flexipage:availableFor​RecordHome" 
description="My lightning component">
  <lightning:quickActionAPI 
    aura:id="quickActionAPI"/>
</aura:component>

Then you can reference the Quick Action APIs in your controller code.

Supported actions, pages, and apps Works with any quick action on a record page in Salesforce Classic apps for objects that are feed-enabled. Works with any quick action on a record page in any Lightning Experience app.
Available methods Provides the following methods:
  • publisher.selectAction
  • publisher.setActionInputValues
  • publisher.invokeAction
  • publisher.customActionMessage
Provides the following methods:
  • selectAction
  • getSelectedActions
  • setActionFieldValues
  • invokeAction
  • getCustomAction
  • refresh
Lightning Experience and Salesforce Classic support

Works in Salesforce Classic and Lightning Experience.

Tip

Tip

Starting with API version 43.0 of the Salesforce Classic JavaScript Publisher API, the methods used in Visualforce components and pages work in Lightning Experience. Just point to the latest version of the Publisher API script in your Visualforce pages.

<script
src="/canvas/sdk/js/43.0/publisher.js"
type="text/javascript">
</script>
Note

Note

The portalPostFields input value is not supported in Lightning Experience.

Works only in Lightning Experience.

Here are a few considerations for working with the Lightning Quick Action APIs.

  • Don’t use the APIs with the following items:
    • Opportunity products
    • Knowledge articles
    • Crew Size field on the Service Crew object
    • Social quick action in the case feed publisher provided with Social Customer Service
  • The lightning:quickActionAPI component doesn’t work in communities.
  • To work with quick actions created with the Custom Visualforce or Lightning Component action type, use the getCustomAction method.