I can't seem to get the QuickActionDefaultsHandler to work at all in Lightning.

Is there anybody that has got it working? Specifically, I'm using the Service Console.

Just to be clear: the "Enable Default Email Templates or the Default Handler for Email Action" is set and is pointing to the correct class.

Update from 2019: this now works in Lightning! See https://releasenotes.docs.salesforce.com/en-us/summer18/release-notes/rn_cases_email_apex_default_fields.htm

2 Answers 2


Indeed, this is not supported in Lightning. In my organization, I mainly overcame this by including the desired logic in a unified Custom HTML email template, and set it as a default for the Email action. Also, I added the recipient list, email subject, FROM, to, cc and bcc fields as formulas in predefined fields on that same Email action. If you'll share your class here, along with the various email templates, i'll be able to assist.

  • 1
    Good to know for sure that it's not yet supported in Lightning! I've now also gone with setting Predefined Fields, which does the job for now. Thanks! Sep 11, 2017 at 19:59
  • @WillemMulder would you be able to share where/how you set your "Predefined Fields" to set the default FROM email address in LEX? Mar 21, 2018 at 18:29
  • 1
    @SwisherSweet - here's an example: screencast.com/t/9Cuy19PVKyJA. Hope this helps.
    – iDog
    Mar 21, 2018 at 18:36
  • @iDog - can you tell me how were you able to include a HTML template as a default for the quick action, the HTML template doesn't even show up in the lookup for me.
    – Khyber
    Feb 12, 2019 at 1:46
  • I confirm, it works in Lightning - Feb 2020
    – Ayub
    Feb 6, 2020 at 6:17

I was facing the same issue and I confirm it it works in lightning. However, I found out following issues in my code:

Mostly people just copy and paste code from here or any article: https://releasenotes.docs.salesforce.com/en-us/summer18/release-notes/rn_cases_email_apex_default_fields.htm

global void onInitDefaults(QuickAction.QuickActionDefaults[] defaults) {
        QuickAction.SendEmailQuickActionDefaults sendEmailDefaults = (QuickAction.SendEmailQuickActionDefaults)defaults.get(0);
        EmailMessage emailMessage = (EmailMessage)sendEmailDefaults.getTargetSObject(); 

        Case c = [SELECT CaseNumber, Priority FROM Case WHERE Id=:sendEmailDefaults.getContextId()];

        // If case severity is “High,” append “[email protected]” to the existing (and possibly blank) BCC field
        if (c.Priority != null && c.Priority.equals('High')) { // Priority is 'High'
            emailMessage.BccAddress = '[email protected]';        

But necessarily "defaults.get(0)" may not be the one you are using on layout. So you need to iterate over all quick actions and find out the correct one as I'm doing below. My quick action developer name is "Email_Member".

global void onInitDefaults(QuickAction.QuickActionDefaults[] defaults) {
        QuickAction.SendEmailQuickActionDefaults sendEmailDefaults = null;
        // Check if the quick action is the standard Case Feed send email action
        for (Integer j = 0; j < defaults.size(); j++) {
            if (defaults.get(j) instanceof QuickAction.SendEmailQuickActionDefaults && 
                defaults.get(j).getTargetSObject().getSObjectType() == EmailMessage.sObjectType && 
                defaults.get(j).getActionName().equals('Case.Email_Member') && defaults.get(j).getActionType().equals('SendEmail')) {
                   sendEmailDefaults = (QuickAction.SendEmailQuickActionDefaults)defaults.get(j);

        if (sendEmailDefaults != null) {
            Case c = [SELECT CaseNumber, Contact.Email, Priority FROM Case WHERE Id=:sendEmailDefaults.getContextId()];
            EmailMessage emailMessage = (EmailMessage)sendEmailDefaults.getTargetSObject();
            emailMessage.BccAddress = null;
            emailMessage.ToAddress = null;//keep null, contact email will come by default

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .