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.
component
<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
<lightning:quickActionAPI aura:id="quickActionAPI" />
<div>
<lightning:button label="Send Email" onclick="{!c.sendEmailAction}"/>
</div>
</aura:component>
Controller js
sendEmailAction : function( cmp, event, helper) {
var actionAPI = cmp.find("quickActionAPI");
var args = {actionName: "SendEmail"};
actionAPI.selectAction(args).then(function(result){
//Action selected; show data and set field values
console.log('test', result);
}).catch(function(e){
if(e.errors){
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:
Thank you in advance!