Im trying invoke a SendEmail global action from a custom button inside Account page. I need that this button have the same behavior that hitting on Gear icon. Apparenly the code below just opens the SendEmail on activity screen and not as clicking from gear icon.


<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
    <lightning:quickActionAPI aura:id="quickActionAPI" />
        <lightning:button label="Send Email" onclick="{!c.sendEmailAction}"/>

Controller js

sendEmailAction : function( cmp, event, helper) {
        var actionAPI = cmp.find("quickActionAPI");

    var args = {actionName: "SendEmail"};

        //Action selected; show data and set field values
        console.log('test', result);

            console.log('test error', e);
            //If the specified action isn't found on the page, show an error message in the my component 

Is possible the code above open a global action as bellow:

enter image description here

Thank you in advance!


You have to specify the recordId as your argument.

 var args = {actionName: "SendEmail",recordId:cmp.get('v.recordId')};

Also in your component, you have implement an extra interface force:hasRecordId to get recordId from the detail page

<aura:component implements="flexipage:availableForAllPageTypes,force:hasRecordId" access="global" >
    <lightning:quickActionAPI aura:id="quickActionAPI" />
        <lightning:button label="Send Email" onclick="{!c.sendEmailAction}"/>

Src: https://developer.salesforce.com/docs/component-library/bundle/lightning:quickActionAPI/documentation

| improve this answer | |
  • 1
    Thank you Pranay, but I already tried it, and do not work for me, the component tries open a email action into acticvity page and not as popup as when clicking in gear icon. – Tiago Carafini Dec 3 '18 at 15:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.