+ Start a Discussion
Ido Greenbaum 10Ido Greenbaum 10 

SalesForce Case Feed - Email Action - Reply and ReplayAll stopped working after summer 16'

Hi fellow Devs, 
We are using the Service Cloud Console, and recently switched to the Case Feed layout. In order to meet our use case, in which different Email Templates and Email Recipients are required, depending the Case Type, we implemented the QuickAction.QuickActionDefaultsHandler.
This was working perfectly fine, until the new Summer 16' release.
It seems that when using 'Reply' or 'ReplyAll' in the case feed, the functionality is broken - the Email Editor doesn't post the Email Thread to which we wish to 'reply' to.

Further testing in our SandBox, using the original example provided in the QuickActionDefaultsHandler reference, leads to understand something is broken. Below is the original code provided in the example:
global class EmailPublisherLoader implements QuickAction.QuickActionDefaultsHandler {
    // Empty constructor
    global EmailPublisherLoader() {
    // The main interface method
    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') && 
               defaults.get(j).getActionType().equals('Email')) {
                   sendEmailDefaults = 
        if (sendEmailDefaults != null) {
            Case c = [SELECT Status, Reason FROM Case 
                      WHERE Id=:sendEmailDefaults.getContextId()];
            EmailMessage emailMessage = (EmailMessage)sendEmailDefaults.getTargetSObject();    
            // Set bcc address to make sure each email goes for audit
            emailMessage.BccAddress = getBccAddress(c.Reason);
            Set Template related fields 
            When the In Reply To Id field is null we know the interface 
            is called on page load. Here we check if 
            there are any previous emails attached to the case and load 
            the 'New_Case_Created' or 'Automatic_Response' template.
            When the In Reply To Id field is not null we know that 
            the interface is called on click of reply/reply all 
            of an email and we load the 'Default_reply_template' template
            if (sendEmailDefaults.getInReplyToId() == null) {
                Integer emailCount = [SELECT count() FROM EmailMessage 
                                      WHERE ParentId=:sendEmailDefaults.getContextId()];
                if (emailCount!= null && emailCount > 0) {
                } else {
            } else {
    private Id getTemplateIdHelper(String templateApiName) {
        Id templateId = null;
        try {
            templateId = [select id, name from EmailTemplate 
                          where developername = : templateApiName].id;   
        } catch (Exception e) {
            system.debug('Unble to locate EmailTemplate using name: ' + 
                templateApiName + ' refer to Setup | Communications Templates ' 
                    + templateApiName);
        return templateId;
private String getBccAddress(String reason) {
        if (reason != null && reason.equals('Technical')) 
            { return 'support_technical@mycompany.com'; } 
        else if (reason != null && reason.equals('Billing')) 
            { return 'support_billing@mycompany.com'; } 
        else { return 'support@mycompany.com'; }

Inspecting the code with the Developer Console leads to understand that the 'getInReplyToId' paramter is not populating (equals Null), despite the 'Reply' or 'ReplyAll' button is clicked:


Any assistance would be much appreciated.
Thank you.
Ido Greenbaum 10Ido Greenbaum 10
Found a bug in my 'QuickActionDefaultsHandler' implementation to be causing this.