function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tristan PTristan P 

Lightning Component to launch Send Email quick action on Cases

Hi,

I'm attempting to build a Lightning Component that will invoke a Send Email quick action on cases. Ideally this should be a button on each Case page that opens the email popup in Lightning Experience and fills in the To and CC fields automatically so that the user can write the email.

This is what I have so far:

Component code:
 
<aura:component implements="lightning:actionOverride,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome">
	
    <lightning:quickActionAPI aura:id="quickActionAPI" />

    <lightning:button label="Send Email" onclick="{!c.SendEmail }" />

</aura:component>

Controller code:
 
({
    SendEmail : function(component, event, helper) {
        
		var actionAPI = component.find("quickActionAPI");
        var args = { actionName :"Case.Send_Email" }; // UpdateContact is the action on the contact object
        actionAPI.selectAction(args).then(function(result) {
            // Action selected; show data and set field values
        })
        
        .catch(function(e) {
            if (e.errors) {
                // If the specified action isn't found on the page, 
                // show an error message in the my component 
            }
    	});
    }
})

At the moment I can click on the button, however nothing happens.

Does anyone know what I am doing wrong? I would rather not use the quick action itself within the chatter publisher as it is not very user friendly, so I'm trying to replicate what the old send email javascript button did in Classic.

Thanks