• Ido Greenbaum 10
  • NEWBIE
  • 105 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 11
    Likes Given
  • 23
    Questions
  • 47
    Replies
How can I create a 'delete' custom button for Lightning, in similarity to the one existing in the Classic details view? : 

User-added image
Can anyone please help with a test class for the following Lightning Case List View custom 'take ownership' button? : 
 
public class CaseAcceptOwnership {
    PageReference cancel;
    Case[] records;
    public CaseAcceptOwnership(ApexPages.StandardSetController c) {
        records = (Case[])c.getSelected();
        cancel = c.cancel();
    }
    public PageReference updateCases() {
        for(Case record: records) {
            record.OwnerId = UserInfo.getUserId();
        }
        update records;
        return cancel.setRedirect(true);
    }
}

 
I am trying to include a conditional logic in my custom Email Template, which includes merge fields.
When I include the following formula in my template:
<br />• Case #: {!IF(Case.RecordType ="Enterprise", {!Case.CaseNumber}, "not enterprise")}

The output in my email template looks as follows:
Case #: , "not enterprise")}

And when I edit the Email Template again, I can see that my code had changed to the following:
<br />• Case #: {!NullValue(IF(Case.RecordType ="Enterprise", "{!Case.CaseNumber")}, "not enterprise")}

Why is that?
I recently completed a customized Email Service, to replace Email-To-Case, which handles duplicates by matching the incoming email subject with existing cases.
As part of the InboundEmailHandler class, I am handling the binary attachment Images under the following function:
 
private static String getImageReference(List<Messaging.InboundEmail.Header> headers){
        for(Messaging.InboundEmail.Header header: headers){
            if(header.name.startsWith('Content-ID') || header.name.startsWith('X-Attachment-Id') || (header.value.startsWith('ii') || header.value.startsWith('< image'))){
                return header.value.replaceAll('<', '').replaceAll('>', '');
            }
        }
        return null;
    }


This is working fine, and the Images appear inline when viewing the incoming Email. The problem I'm facing - when using 'Reply' / 'Reply All' of the Email Message feed item in the Case object, the Email Publisher sets the Email Thread, but the inline images are replaces with: [Image is no longer available]
Can anyone suggest a valid solution for this? As a side note - in the traditional Email-To-Case, the email thread includes the inline images properly upon reply. If they only shared the source code of this solution....
Thank you.
I have an Email Service set up to implement the Messaging.InboundEmailHandler interface.
For Cases created through my Email Service, the images in the sent email appears as 'inline image 1' and converted to attachments on the Case:

User-added image

I suspect that the default Email-To-Case mechanism has a special treatment to show the images in the Case Feed (as introduced in Summer 15' - https://releasenotes.docs.salesforce.com/en-us/summer15/release-notes/rn_e2c_html_email_feed_items.htm), and wonder if there is any workaround to incorporate the same functionality for the Email services implementation.
Looking online, I bumped into the 'Handling Inline Images in Salesforce Inbound Email' article, but this doesn't seem to be working.
Thank you.
I am trying to workaround the lack of inline images in a custom rich text field I created named 'Description_HTML__c', using the article below: http://www.mstsolutions.com/blog/content/handling-inline-images-email-content-email-case#comment-4

I created an Apex Class:
public class getHtmlHandler{
static list<case> caseList = new list<case>();
@future
public static void processEmailMessage(List<Id> emailMsgIds){
    for(EmailMessage em : [SELECT Id, ParentId, HtmlBody FROM emailMessage WHERE Id IN: emailMsgIds]){
        case cc = new case();
    cc.id = em.ParentId;
    cc.Description_HTML__c = em.HtmlBody;
    caseList.add(cc);
}
update caseList;
}
}


And a Trigger on EmailMessage:
trigger HandlingHtmlContent on EmailMessage (before insert) {
    List<Id> emailMsgId = new List<Id>();
    for(EmailMessage em : Trigger.New){
    emailMsgId.add(em.id);
    }
    getHtmlHandler.processEmailMessage(emailMsgId);
}


This doesn't seem to be working. The customer Rich-Text field 'Description_HTML__c' is left empty.
I have the following Trigger on case, to copy the HTMLBody of the first Incoming EmailMessage (for 'Email' originated cases), into a custom Rich-Text field:
 
trigger updateCaseDescription on Case (before update) {
    set<Id> parentIds = new set<Id>();
    map<Id,EmailMessage> mapEmailMessage = new map<Id,EmailMessage>();
    for(Case c:trigger.new){   
        parentIds.add(c.Id);
    }   
    list<EmailMessage> lste = [select id,HtmlBody,parentId from EmailMessage where parentid in:parentIds and Incoming = true ORDER By parentId];

    if(lste.size() > 0 ){
     for(EmailMessage e:lste){
    if(!mapEmailMessage.containsKey(e.parentId))
    {
       mapEmailMessage.put(e.parentId,e);
    }
}
     list<Case> lstC = new list<Case>();
     for(Case c:trigger.new){ 
      if
      (mapEmailMessage != null && mapEmailMessage.get(c.Id) != null && String.isBlank(c.Description_HTML__c) && c.Origin == 'Email')  
          c.Description_HTML__c = mapEmailMessage.get(c.Id).HtmlBody;       
     }
    }
}

The trigger is working properly, but I can't seem to find how to present the Images (instead of 'inline image'):
User-added image
Hi, 

We have Email-To-Case implemented, and the Case Descriptioin field is receiving the Incoming Email message body. 
The Case Descriptioin Standard Field appears in our Case Feed Custom Console Component (and also in the standard layout) as a 'Long Text Area' which is a Text version of the incoming Email message, sent as HTML. 

How can I wokraround this, and present the HTML in Case Description? 
I thought of creating a custom Rich Text field (i.e - 'Description - HTML'), and use a Formula to 'copy' the data from the 'Case Description' field, but it appears the Formula throws the following error: 
"Error: You referenced an unsupported field type called "Long Text Area" using the following field: Description":
User-added image

Are there any other workarounds to present the HTML version of the Case Description? 

Thank you, 
Ido. 
I have an Apex Class 'EmailPublisherLoader', which implements QuickAction.QuickActionDefaultsHandler, to set dynamic Email Templates, Recipients and From address in the Case Feed Email Publisher.

I am struggling with pushing the code to production, as the test class yields 74% coverage. I wonder which additional tests can be added to raise the test code coverage.

Below is the Apex Class:
 
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 = 
                       (QuickAction.SendEmailQuickActionDefaults)defaults.get(j);
                   break;
            }
        }

         if (sendEmailDefaults != null) {
            Case c = [SELECT Status, contact.Email, Additional_To__c, Additional_CC__c, Additional_BCC__c, RecordType.name FROM Case WHERE Id=:sendEmailDefaults.getContextId()];
            EmailMessage emailMessage = (EmailMessage)sendEmailDefaults.getTargetSObject();  

    //set TO address
         String contactEmail = c.contact.Email; 
         if (c.contact.Email == c.Additional_To__c){
            emailMessage.toAddress = (c.contact.Email);
            }
            else{
                if (c.Additional_To__c != null){
                    //contactEmail is included in Additional TO
                    if (c.Additional_To__c.indexOf(contactEmail) != -1){
                        emailMessage.toAddress = (c.Additional_To__c);
                        }
                else{
                    emailMessage.toAddress = (c.contact.Email+' '+c.Additional_To__c);
                    }
                }
            }
    //set CC address
            emailMessage.ccAddress = (c.Additional_CC__c);
    //set BCC address        
            emailMessage.bccAddress = (c.Additional_BCC__c);
    //set From 'security@test.com' for 'Security' RecordType
            if (c.recordtype.name  == 'Security'){
            emailMessage.fromAddress = ('security@test.com');
            }

    //if In Reply To Id field is null we know the interface is called on page load
        if (sendEmailDefaults.getInReplyToId() == null) {

                    if (c.recordtype.name  == 'Consumer'){
                        sendEmailDefaults.setTemplateId(getTemplateIdHelper('Custom_Default_Consumer_Email'));                       
                        }
                        else if (c.recordtype.name  == 'Security') {
                            sendEmailDefaults.setTemplateId(getTemplateIdHelper('Custom_Default_Security_Email'));
                            } 
                            else {
                            sendEmailDefaults.setTemplateId(getTemplateIdHelper('Custom_Default_Enterprise_Email'));
                            }                

           }
          // Now, we know that the 'Reply' or 'Reply All' button has been clicked, so we load the default response template 
          else
          {
               if (c.recordtype.name  == 'Consumer'){
                            sendEmailDefaults.setTemplateId(getTemplateIdHelper('Custom_Default_Consumer_Email_No_Body'));
                            sendEmailDefaults.setInsertTemplateBody(true);
               }
               else if (c.recordtype.name  == 'Security') {
                            sendEmailDefaults.setTemplateId(getTemplateIdHelper('Custom_Default_Security_Email'));
                            sendEmailDefaults.setInsertTemplateBody(true);
               }
                   else {
                            sendEmailDefaults.setTemplateId(getTemplateIdHelper('Custom_Default_Enterprise_Email_No_Body'));
                            sendEmailDefaults.setInsertTemplateBody(true);
                   }      
          }
         }
       }

    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;
    }
}
And the Test Class:
@isTest
private class EmailPublisherLoaderTest {
    static Case myCase {get;set;}
    static EmailMessage myMsg {get;set;}

    static testmethod void EmailPublisherLoader_NoReplyToId() {
        Exception failureDuringExecution = null;
        init();
        init2();
        init3();
        init4();

        //create QuickActionDefaults
        List<Map<String, Object>> defaultSettingAsObject = new List<Map<String, Object>>
        {
          new Map<String, Object>
          {
                'targetSObject' => new EmailMessage(),
                'contextId' => myCase.Id,
                'actionType' => 'Email',
                'actionName' => 'Case.Email',
                'fromAddressList' => new List<String> { 'salesforce@test.com' }
          }
        };

        List<QuickAction.SendEmailQuickActionDefaults> defaultsSettings = 
            (List<QuickAction.SendEmailQuickActionDefaults>)JSON.deserialize(JSON.serialize(defaultSettingAsObject), List<QuickAction.SendEmailQuickActionDefaults>.class);
        Test.startTest();
        try {
            (new EmailPublisherLoader()).onInitDefaults(defaultsSettings);
        }
        catch(Exception e) {
            failureDuringExecution = e; 
        }

        Test.stopTest();
        System.assertEquals(null, failureDuringExecution, 'There was an exception thrown during the test!');
    }
    static testmethod void EmailPublisherLoader_WithReplyToId() {
        Exception failureDuringExecution = null;
        init();
        init2();
        init3();
        init4();

        //create QuickActionDefaults
        List<Map<String, Object>> defaultSettingAsObject = new List<Map<String, Object>>
        {
          new Map<String, Object>
          {
                'targetSObject' => new EmailMessage(),
                'replyToId' => myMsg.Id,
                'contextId' => myCase.Id,
                'actionType' => 'Email',
                'actionName' => 'Case.Email',
                'fromAddressList' => new List<String> { 'salesforce@test.com' }
          }
        };

        List<QuickAction.SendEmailQuickActionDefaults> defaultsSettings = 
            (List<QuickAction.SendEmailQuickActionDefaults>)JSON.deserialize(JSON.serialize(defaultSettingAsObject), List<QuickAction.SendEmailQuickActionDefaults>.class);
        Test.startTest();
        try {
            (new EmailPublisherLoader()).onInitDefaults(defaultsSettings);
        }
        catch(Exception e) {
            failureDuringExecution = e; 
        }

        Test.stopTest();
        System.assertEquals(null, failureDuringExecution, 'There was an exception thrown during the test!');
    }

    static void init(){
        myCase = 
            new Case(
                Status='Status'
                , Origin='Email'
                , Reason = 'Reason'
                , RecordTypeId = '01261000000XfOl'
            );
        insert myCase;

        myMsg = 
            new EmailMessage(
                ParentId = myCase.Id
            );
        insert myMsg;
    }
     static void init2(){
        myCase = 
            new Case(
                Status='Status'
                , Origin='Email'
                , Reason = 'Reason'
                , RecordTypeId = '01261000000XfOq'
            );
        insert myCase;

        myMsg = 
            new EmailMessage(
                ParentId = myCase.Id
            );
        insert myMsg;
    }
    static void init3(){
        myCase = 
            new Case(
                Status='Status'
                , Origin='Email'
                , Reason = 'Reason'
                , RecordTypeId = '01261000000iuJL'
            );
        insert myCase;

        myMsg = 
            new EmailMessage(
                ParentId = myCase.Id
            );
        insert myMsg;
    }
    static void init4(){
        myCase = 
            new Case(
                Status='Status'
                , Origin='Email'
                , Reason = 'Reason'
                , RecordTypeId = '01261000000XfP0'
            );
        insert myCase;

        myMsg = 
            new EmailMessage(
                ParentId = myCase.Id
            );
        insert myMsg;
    }
    @isTest
static void test_mockIfAtAllPossible(){
}
}



 
Hey all, 

I have a running implementation of a customized Email Publisher in the Case Feed, which implement QuickActionDefaultHandler to pre-populate Email Templates based on my Cases Record Type. Below is the Apex Class:
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 = 
                       (QuickAction.SendEmailQuickActionDefaults)defaults.get(j);
                   break;
            }
        }

         if (sendEmailDefaults != null) {
            Case c = [SELECT Status, contact.Email, Additional_To__c, Additional_CC__c, Additional_BCC__c, RecordType.name FROM Case WHERE Id=:sendEmailDefaults.getContextId()];
            EmailMessage emailMessage = (EmailMessage)sendEmailDefaults.getTargetSObject();  
    //set TO address
         if (c.contact.Email == c.Additional_To__c){
            emailMessage.toAddress = (c.contact.Email);
            }
            else{
            if (c.Additional_To__c != null){
            emailMessage.toAddress = (c.contact.Email+' '+c.Additional_To__c);
            }
            }

In addition, I am setting the TO address according a combination of the Case Contact and the custom field - 'Additional_To__c'. The above solution is setting the TO properly, but when the Case Contact does exist in the 'Additional_To__c' as follows:

User-added image

The outcome is a duplicity of the Case Contact - 'test@test.com': 
User-added image

How can I change the IF statement to avoid the above duplicitity? 
Hi, 

I came up with an Apex Class to extract the User Profile Picture, to be used in a VisualForce Email Templat : 
 
public class UserProfilePicture {
    public String profileImageUrl { get; set; }
    List<user> lstuser;
  
    
    public UserProfilePicture () {
         lstuser = [select FullPhotoUrl from User where Id =: UserInfo.getUserId()];
         profileImageUrl=lstuser[0].FullPhotoUrl; 
    }
}



Can anyone please assist with a test for this class? 

Thank you, 
Ido. 
Hi Community, 

I have the below VisualForce Email Template:
 
<messaging:emailTemplate subject="[Email] #{!relatedTo.CaseNumber} - {!relatedTo.Subject} - {!relatedTo.Contact.Name}" recipientType="User" relatedToType="Case">
<messaging:htmlEmailBody >
<html>
<style type="text/css">
body {font-family: arial; size: 12pt;}
</style>
<body>
    <img src="https://my.salesforce.com/servlet/servlet.ImageServer?id=01561000001JYOm&oid=OBFUDCATED"/><br/>
A <b>new Email</b> was added to the case below:
<br />------------------------
<br />• Case #: {!relatedTo.CaseNumber}
<br />• Account:&nbsp;<apex:outputLink value="https://my.salesforce.com/{!relatedTo.Account}">{!relatedTo.Account.Name}</apex:outputLink>
<br />• Contact Name:&nbsp;<apex:outputLink value="https://my.salesforce.com/{!relatedTo.Contact}">{!relatedTo.Contact.Name}</apex:outputLink>
<br />• Case status: {!relatedTo.Status}
<br />• Priority: {!relatedTo.Priority}<apex:image id="theImage" value="{!relatedTo.Priority_Flags_URL__c}" width="12" height="12"/>
<br />• Link: https://my.salesforce.com/{!relatedTo.Id}
<apex:outputPanel rendered="{!relatedTo.Jira__c!=null}" >
<br />• Jira issue:&nbsp;<apex:outputLink value="https://www.atlassian.net/browse/{!relatedTo.Jira__c}">{!relatedTo.Jira__c}</apex:outputLink></apex:outputPanel>
<apex:outputPanel rendered="{!relatedTo.Git_Link__c!=null}" >
<br />• Git Link:&nbsp;<apex:outputLink value="{!relatedTo.Git_Link__c}">{!relatedTo.Git_Link__c}</apex:outputLink></apex:outputPanel>
<br />------------------------
<apex:outputPanel rendered="{!relatedTo.Last_Incoming_Email_Content__c!=null}" style="white-space:pre;">
<h3><br /><b><u>Case Last Incoming Email:</u></b></h3><br />
<apex:outputField value="{!relatedTo.Last_Incoming_Email_Content__c}" style="white-space:pre;"></apex:outputField>
</apex:outputPanel>
</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
This VF Email is used in a WorkFlow rule, to send and Email Alert for each new incoming Email to the case which is under his custody. The WorkFlow Rule is pretty simple, it 'listens' to the change in the Custom Field 'Last_Incoming_Email_Content__c', and fires the email notification.

The issue is that the Email notification doesn't populate the Merge Fields: 

User-added image

Below is my email client's 'original' massage:
Date: Mon, 31 Oct 2016 12:13:08 +0000 (GMT)
From: System <obfuscated>
Sender: noreply@salesforce.com
To: "obfuscated" <obfuscated>
Message-ID: <QLFAw000000000000000000000000000000000000000000000OFWV9W004MUKYztRQrCfzfyDk0URBQ@sfdc.net>
Subject: [Email] #00008640 -
  -
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="----=_Part_16014_1675508803.1477915988038"
X-SFDC-LK: 00D61000000edsH
X-SFDC-User: 00561000001nhq1
X-Sender: postmaster@salesforce.com
X-mail_abuse_inquiries: http://www.salesforce.com/company/abuse.jsp
X-SFDC-TLS-NoRelay: 1
X-SFDC-Binding: 1WrIRBV94myi25uB
X-SFDC-EmailCategory: workflowActionAlert
X-SFDC-EntityId: obfuscated
X-SFDC-Interface: internal

------=_Part_16014_1675508803.1477915988038
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit


------=_Part_16014_1675508803.1477915988038
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit


<html>
<style type="text/css">
<!--

body {font-family: arial; size: 12pt;}

//-->
</style>
In addition, when testing with the 'test and verify merge fiels' in the Email Template editor, everything looks fine:

User-added image

Thank you
Hi Commnunity, 

I was able to complete a customized 'CaseEmailExtension' code solution in my SandBox, which queries a Case EmailMessages, and output these to a VisualForce Email Template.
I am struggling with adding the Tests, and would be glad to receive some help.
Below is the VisualForce Component:
<apex:component controller="CaseEmailExtension" access="global">
    <apex:attribute name="caseId" type="Id"  description="Case Id" assignTo="{!csId}"/>    
            <apex:repeat value="{!sortEmails}" var="email">
    <apex:outputText value="{0,date,dd'.'MM'.'yyyy HH:mm:ss z}" style="font-weight:bold;font-style:italic;font-size:15px;float:left">
                    <br><apex:param value="{!email.MessageDate}" /></br></apex:outputText>
                    <br>From: &nbsp; <apex:outputText value="{!email.FromAddress}"/></br>
                    To: &nbsp; <apex:outputText value="{!email.ToAddress}"/>
                    <apex:outputPanel rendered="{!email.CcAddress!=null}" >
                    <br>Cc: &nbsp; <apex:outputText value="{!email.CcAddress}"/></br></apex:outputPanel>
                    <apex:outputPanel rendered="{!email.BccAddress!=null}" >
                    Bcc: &nbsp; <apex:outputText value="{!email.BccAddress}"/></apex:outputPanel>
                    <br>Subject: &nbsp; <apex:outputText value="{!email.Subject}"/></br>
                    <br><apex:outputText value="{!email.HtmlBody}" escape="false"/></br>
____________________________________________
        </apex:repeat>
</apex:component>
And the Apex Class:
 
public with sharing class CaseEmailExtension {

public ID csId {get; set;}  // comes from assignTo on component 

public CaseEmailExtension() { }
    
private final Case currentCase;

public CaseEmailExtension(ApexPages.StandardController currentcase) {
    this.currentCase = (Case)currentcase.getRecord();
  }

  public List<EmailMessage> getSortEmails(){
  String contactEmail = [SELECT Id, ContactEmail FROM Case where Id=:csId].get(0).ContactEmail;
  contactEmail = '%'+contactEmail+'%';
    return this.csId == null
        ? new List<EmailMessage>()  // handles UI preview use case
        : [SELECT Id, FromAddress, ToAddress, BCCAddress, CcAddress, MessageDate, Subject, Incoming, HtmlBody, CreatedBy.Name   
            from EmailMessage where ParentId =: this.csId AND(FromAddress LIKE :contactEmail OR ToAddress LIKE :contactEmail OR BCCAddress LIKE :contactEmail OR CcAddress LIKE :contactEmail)
            order by MessageDate DESC ];
  }
}

Thank you.
I have set a Custom Field ('Priority_Flags__c') on the Case object, to represent priority flags as follows:
 
IMAGE( 
CASE( Priority, 
"Low", "/img/samples/flag_green.gif", 
"Medium", "/img/samples/flag_yellow.gif", 
"High", "/img/samples/flag_red.gif", 
"Critical", "/img/samples/flag_red.gif", 
"/s.gif"), 
"Priority Flag")
I included this custom field to be merged in a VisualForce Email Template as follows:
<messaging:emailTemplate subject="[Assignment] Case #{!relatedTo.CaseNumber}: {!relatedTo.Subject}" recipientType="User" relatedToType="Case">
    <messaging:htmlEmailBody >
    <html>
    <style type="text/css">
            body {font-family: arial; size: 12pt;}
        </style>
    <body>
        The following case was assigned to <b>{!relatedTo.Owner.Name}</b>:
        <br />------------------------
        <br />• Case #: {!relatedTo.CaseNumber}
        <br />• Account: <apex:outputLink value="https://my.salesforce.com/{!relatedTo.Account}"> {!relatedTo.Account.Name}</apex:outputLink>
        <br />• Contact Name: {!relatedTo.Contact.Name}
        <br />• Case status: {!relatedTo.Status}
        <br />• Priority: {!relatedTo.Priority_Flags__c} {!relatedTo.Priority}
        <br />• Link: https://my.salesforce.com/{!relatedTo.Id} 
        <br />------------------------
        <br />        
</body>
</html>
</messaging:htmlEmailBody>   
</messaging:emailTemplate>
It seems that the rendered Merged Field is not the image as expected, but the img HTML statement:

User-added image

Is there a way to make this work, and render the IMAGE in the VisualForce Email Template? 

Hi Developers Community, 

We have an issue with the Case.Email_Thread merge field not populating as part of a workflow rule, which SalesForce support admitted as a known issue. We currently awaits the developers to provide a bug fix, or a Known Issue reference we can follow. 

SalesForce Support suggested replicating the 'Case.Thread_ID' to a custom field, and place it on the Case Page Layout, thinking that if it would be visible for the workflow rule, it might populate the 'Case.Email_Thread'. We tried that, but unfurtunately, this doesn't work. 

I am seeking for a workaround. Basically, our business requirement is to auto-close a case after 3 days of inactivity, as part of a WorkFlow Rule, which emails the customer with an Email Template that needs to include the 'Case.Email_Thread', so the customer receives the full context to which the email alert refers to. 

For the time being, we added the 'Subject' and 'Description' case fields to be merged in the Email Template, but that's not ideal: 

User-added image

Would it be possible to replicate the 'Case.Email_Thread' to a Custom Field using 'Formula'? I couln't find any reference for the 'Case.Email_Thread'. 

Thakn you, 

Ido. 

Thank you, 
​Ido. 

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 = 
                       (QuickAction.SendEmailQuickActionDefaults)defaults.get(j);
                   break;
            }
        }
        
        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) {
                    sendEmailDefaults.setTemplateId(
                        getTemplateIdHelper('Automatic_Response'));
                } else {
                    sendEmailDefaults.setTemplateId(
                        getTemplateIdHelper('New_Case_Created'));
                }
                sendEmailDefaults.setInsertTemplateBody(false);
                sendEmailDefaults.setIgnoreTemplateSubject(false);
            } else {
                sendEmailDefaults.setTemplateId(
                    getTemplateIdHelper('Default_reply_template'));
                sendEmailDefaults.setInsertTemplateBody(false);
                sendEmailDefaults.setIgnoreTemplateSubject(true);
            }
        }
    }
    
    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:

replyall

Any assistance would be much appreciated.
Thank you.
Hi Community, 
A question regards the 'Files' Custom Component in the Service Cloud Console. 
The default behaviour is that the Files shows the recent list
When clicking 'show all', the list includes the 'emailed' files as well. 

show all

Can anyone suggest a way to make the 'show all' as default? Obviously, our Support Agents are missing important attachments which the current view. 

Thank you, 
Ido. 
Hi Community, 

I am wondering if it would somehow be possible to reach the source code (Apex classes, VisualForce Page and Components, etc.) of the native Service Cloud Console Components. 
I have few slight modifications (i.e - change functionality, UI, etc), and was wondering how to achieve that. 

Thank you, 
Ido. 
Hi Community, 
I have a business use case demand to show a list of Cases for the current associated Contact on the Case Feed. 
I was able to achieve this with the below VisualForce Page: 
<apex:page standardcontroller="Case">
<apex:relatedList list="Cases" subject="{!Case.ContactId}"/>
</apex:stylesheet>
</apex:page>
As can be seen in the result, I have the traditional SalesForce CSS, which doesn't feet the overhaul Case Feed layout - based on Lightning: 
cases by contact

Now, I am trying to set the CSS of the VisualForce Page to match the lighning design, with the below addition: 
<apex:stylesheet value="/resource/SLDS080/assets/styles/salesforce-lightning-design-system-vf.css">
And this doesn't seem to have any affect. 

Can anyone assist in understanding what's the easiest way to 'tweak' the VF Page to have the Lighning UI? 

Thakn you, 
Ido. 
 
Hi Community, 

We recently migrated to the new Case Feed, and I was wondering if there is any elegant way to include Custom Buttons / Links, without adding the 'Custom Button/Links' as a component, as it take some expensive real estate screen : 

custom buttons

real estate

Thank you.
I have an Email Service set up to implement the Messaging.InboundEmailHandler interface.
For Cases created through my Email Service, the images in the sent email appears as 'inline image 1' and converted to attachments on the Case:

User-added image

I suspect that the default Email-To-Case mechanism has a special treatment to show the images in the Case Feed (as introduced in Summer 15' - https://releasenotes.docs.salesforce.com/en-us/summer15/release-notes/rn_e2c_html_email_feed_items.htm), and wonder if there is any workaround to incorporate the same functionality for the Email services implementation.
Looking online, I bumped into the 'Handling Inline Images in Salesforce Inbound Email' article, but this doesn't seem to be working.
Thank you.
Is there anyway to change the Case tab title to the SUBJECT instead of the CASE NUMBER?

Please see below snapshot. 
User-added image

Your help will be highly appreciated.

Thanks in advance!
Prashant Raiyani
We've recently moved to Salesforce Service Cloud (lightning) from Zendesk, and one of the useful things in ZenDesk is you can see if someone else is viewing a ticket (attached screenshot). I don't see anything like that in Salesforce, is there something that can be built that shows users viewing a case?

User-added image
I am trying to include a conditional logic in my custom Email Template, which includes merge fields.
When I include the following formula in my template:
<br />• Case #: {!IF(Case.RecordType ="Enterprise", {!Case.CaseNumber}, "not enterprise")}

The output in my email template looks as follows:
Case #: , "not enterprise")}

And when I edit the Email Template again, I can see that my code had changed to the following:
<br />• Case #: {!NullValue(IF(Case.RecordType ="Enterprise", "{!Case.CaseNumber")}, "not enterprise")}

Why is that?
We just started using Case management for our Support group. One of the issues they've raised is related to Closing a Case. 
They don't want have to seperately click 'Send' mail to the customer with case closing message then click 'Close Case' to close the case. 
They would like use standard Email tab by sending Email and change status as Closed from Standard Email page layout.

Can anyone suggest how I would go about doing that?

User-added image


Thanks & Regards,
Prashant
Hi,

In the past I created a VF page that had 4 buttons on it to do 4 actions. Take Ownership...Flag a Case...etc. When I put the VF page on as a lightning component the buttons do not work. The buttons are controlled with Javascript in the VF code.
I am assuming that I have to redesign the page to be a lightning component. This isn't a question on how to do, I am wondering what to do to get these buttons to work in the Lightning Experience.

Thanks,
-Julio Hernandez
After user sends an email using an object's Quick Email Action, I want SF to automatically change the Status (Picklist) field within that Object.

I've tried Process Builder -- approaching from the Custom Object and from the "Email Message" Object. No luck.

Any tips?
In Classic you could launch the email tool with parameter to pre-populate the email (recipient, subject, attachment )
Does anyone know if you can do something similar in Lightning?
Hi, 

We have Email-To-Case implemented, and the Case Descriptioin field is receiving the Incoming Email message body. 
The Case Descriptioin Standard Field appears in our Case Feed Custom Console Component (and also in the standard layout) as a 'Long Text Area' which is a Text version of the incoming Email message, sent as HTML. 

How can I wokraround this, and present the HTML in Case Description? 
I thought of creating a custom Rich Text field (i.e - 'Description - HTML'), and use a Formula to 'copy' the data from the 'Case Description' field, but it appears the Formula throws the following error: 
"Error: You referenced an unsupported field type called "Long Text Area" using the following field: Description":
User-added image

Are there any other workarounds to present the HTML version of the Case Description? 

Thank you, 
Ido. 
Hey all, 

I have a running implementation of a customized Email Publisher in the Case Feed, which implement QuickActionDefaultHandler to pre-populate Email Templates based on my Cases Record Type. Below is the Apex Class:
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 = 
                       (QuickAction.SendEmailQuickActionDefaults)defaults.get(j);
                   break;
            }
        }

         if (sendEmailDefaults != null) {
            Case c = [SELECT Status, contact.Email, Additional_To__c, Additional_CC__c, Additional_BCC__c, RecordType.name FROM Case WHERE Id=:sendEmailDefaults.getContextId()];
            EmailMessage emailMessage = (EmailMessage)sendEmailDefaults.getTargetSObject();  
    //set TO address
         if (c.contact.Email == c.Additional_To__c){
            emailMessage.toAddress = (c.contact.Email);
            }
            else{
            if (c.Additional_To__c != null){
            emailMessage.toAddress = (c.contact.Email+' '+c.Additional_To__c);
            }
            }

In addition, I am setting the TO address according a combination of the Case Contact and the custom field - 'Additional_To__c'. The above solution is setting the TO properly, but when the Case Contact does exist in the 'Additional_To__c' as follows:

User-added image

The outcome is a duplicity of the Case Contact - 'test@test.com': 
User-added image

How can I change the IF statement to avoid the above duplicitity? 
Hi, 

I came up with an Apex Class to extract the User Profile Picture, to be used in a VisualForce Email Templat : 
 
public class UserProfilePicture {
    public String profileImageUrl { get; set; }
    List<user> lstuser;
  
    
    public UserProfilePicture () {
         lstuser = [select FullPhotoUrl from User where Id =: UserInfo.getUserId()];
         profileImageUrl=lstuser[0].FullPhotoUrl; 
    }
}



Can anyone please assist with a test for this class? 

Thank you, 
Ido. 
Hi Community, 

I have the below VisualForce Email Template:
 
<messaging:emailTemplate subject="[Email] #{!relatedTo.CaseNumber} - {!relatedTo.Subject} - {!relatedTo.Contact.Name}" recipientType="User" relatedToType="Case">
<messaging:htmlEmailBody >
<html>
<style type="text/css">
body {font-family: arial; size: 12pt;}
</style>
<body>
    <img src="https://my.salesforce.com/servlet/servlet.ImageServer?id=01561000001JYOm&oid=OBFUDCATED"/><br/>
A <b>new Email</b> was added to the case below:
<br />------------------------
<br />• Case #: {!relatedTo.CaseNumber}
<br />• Account:&nbsp;<apex:outputLink value="https://my.salesforce.com/{!relatedTo.Account}">{!relatedTo.Account.Name}</apex:outputLink>
<br />• Contact Name:&nbsp;<apex:outputLink value="https://my.salesforce.com/{!relatedTo.Contact}">{!relatedTo.Contact.Name}</apex:outputLink>
<br />• Case status: {!relatedTo.Status}
<br />• Priority: {!relatedTo.Priority}<apex:image id="theImage" value="{!relatedTo.Priority_Flags_URL__c}" width="12" height="12"/>
<br />• Link: https://my.salesforce.com/{!relatedTo.Id}
<apex:outputPanel rendered="{!relatedTo.Jira__c!=null}" >
<br />• Jira issue:&nbsp;<apex:outputLink value="https://www.atlassian.net/browse/{!relatedTo.Jira__c}">{!relatedTo.Jira__c}</apex:outputLink></apex:outputPanel>
<apex:outputPanel rendered="{!relatedTo.Git_Link__c!=null}" >
<br />• Git Link:&nbsp;<apex:outputLink value="{!relatedTo.Git_Link__c}">{!relatedTo.Git_Link__c}</apex:outputLink></apex:outputPanel>
<br />------------------------
<apex:outputPanel rendered="{!relatedTo.Last_Incoming_Email_Content__c!=null}" style="white-space:pre;">
<h3><br /><b><u>Case Last Incoming Email:</u></b></h3><br />
<apex:outputField value="{!relatedTo.Last_Incoming_Email_Content__c}" style="white-space:pre;"></apex:outputField>
</apex:outputPanel>
</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
This VF Email is used in a WorkFlow rule, to send and Email Alert for each new incoming Email to the case which is under his custody. The WorkFlow Rule is pretty simple, it 'listens' to the change in the Custom Field 'Last_Incoming_Email_Content__c', and fires the email notification.

The issue is that the Email notification doesn't populate the Merge Fields: 

User-added image

Below is my email client's 'original' massage:
Date: Mon, 31 Oct 2016 12:13:08 +0000 (GMT)
From: System <obfuscated>
Sender: noreply@salesforce.com
To: "obfuscated" <obfuscated>
Message-ID: <QLFAw000000000000000000000000000000000000000000000OFWV9W004MUKYztRQrCfzfyDk0URBQ@sfdc.net>
Subject: [Email] #00008640 -
  -
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="----=_Part_16014_1675508803.1477915988038"
X-SFDC-LK: 00D61000000edsH
X-SFDC-User: 00561000001nhq1
X-Sender: postmaster@salesforce.com
X-mail_abuse_inquiries: http://www.salesforce.com/company/abuse.jsp
X-SFDC-TLS-NoRelay: 1
X-SFDC-Binding: 1WrIRBV94myi25uB
X-SFDC-EmailCategory: workflowActionAlert
X-SFDC-EntityId: obfuscated
X-SFDC-Interface: internal

------=_Part_16014_1675508803.1477915988038
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit


------=_Part_16014_1675508803.1477915988038
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit


<html>
<style type="text/css">
<!--

body {font-family: arial; size: 12pt;}

//-->
</style>
In addition, when testing with the 'test and verify merge fiels' in the Email Template editor, everything looks fine:

User-added image

Thank you
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 = 
                       (QuickAction.SendEmailQuickActionDefaults)defaults.get(j);
                   break;
            }
        }
        
        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) {
                    sendEmailDefaults.setTemplateId(
                        getTemplateIdHelper('Automatic_Response'));
                } else {
                    sendEmailDefaults.setTemplateId(
                        getTemplateIdHelper('New_Case_Created'));
                }
                sendEmailDefaults.setInsertTemplateBody(false);
                sendEmailDefaults.setIgnoreTemplateSubject(false);
            } else {
                sendEmailDefaults.setTemplateId(
                    getTemplateIdHelper('Default_reply_template'));
                sendEmailDefaults.setInsertTemplateBody(false);
                sendEmailDefaults.setIgnoreTemplateSubject(true);
            }
        }
    }
    
    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:

replyall

Any assistance would be much appreciated.
Thank you.
Hi Team,
We are facing some issues when it will create CASE record in salesforce. We have implemented Email to Case standard features is our production org. when we are sending email to particular mail box with copy of cc someone then as per designed case is created successfully in to Salesforce. But before someone reply from Salesforce, some body who's copied in that email, they started sending email using same email thread from outlook. So its getting generated new case whenever Salesforce receive email. Since no body reply back from Salesforce, so there is no ref number also.
Please find the below example for your understanding
Current Issues :
1. XYZ customer sending email with CC people and subject name as "ABC" to salesforce and case got Created Salesforce with Subject name as "ABC".
2. Immediately CC people replying to email message using same email thread in outlook.
3. Salesforce will receive one more email with same subject name as "ABC" and new case will be created.

Expected Solution:
1. Only one case should be created under same subject name as "ABC". Even though if Salesforce receive multiple email from outlook with same subject.
2. We need to capture the Email information from cc people. (Technically, we need to capture the Email message records not case record)
3. All Email Message should comes under same Case.

As part of the above scenario, I have wriiten some logic in before insert trigger on Email message object and i am successfully able to idenity the Same subject and delete the duplicate case.
Now my question, is there any way to distinguish the case other than subject. Also I have checked on Email Message object, it storing Email Headers. Is there any unique way to identfier using Email Header ??

Any help, really appreciate
thanks,
 
Hello all,

I'm trying to include body of the email in auto reponse email using {!Case.Email_Thread} but it is not working. I reached out to SF support and according to them it is working as expected and email thread doesn't work in auto response template. Also they suggested that I need to develop VF template and/or apex code to achive this functionality and that is the reason I'm posting my question here to get help. 

Thanks in advance,

Parv
Hi Team,

Could you advise how to include the case email thread into email alert?

When there is a new email received by a case, SF has a standard function to send out a notificaiton to case owners, and in that notification it includes the customer's new email. We just need the same notification to be sent to another case related user besides the case owner, and we've set up a workflow rule to trigger an email alert. Howver, the merge field {!Case.Email_Thread} don't work in the email template and as confirmed with SF support this is not possible through standard configuration as today.

Would be appreciated if anyone can help with this by coding, thanks in advance.

I am creating a visualforce page which will display the profile photo of the user in it.

Can someone help me reference it ?

Is there anyway to change the Case tab title to the SUBJECT instead of the CASE NUMBER?

Please see below snapshot. 
User-added image

Your help will be highly appreciated.

Thanks in advance!
Prashant Raiyani
Hey there! We're using Salesforce Service Cloud in lightning. There is a refresh case feed button that will not refresh the page, just the feed with new messages. So a rep can be writing an email, and then suddenly a new chatter post was pasted or something.

Is there a way we can have this case feed refresh trigger every 15-30 seconds?

User-added image
Hi All
Is there any way to push notification when record created  like this 
User-added image
 
Hi All.

Could you please help us to find a solution for our issue?

We need to set a custom URL for our SF Community (not a Force.com site). To do that we performed the following steps:
- registered a custom domain (www.mycompany.com) using the GoDaddy service and added a necessary CNAME there to point this URL to our SF community.
- added a domain for this URL in Salesforce.
- created a Custom URL in Salesforce to point this domain to the community.

Now, if we enter a custom URL in a browser (www.mycompany.com), then it correctly redirects us to the Salesforce community. And it's exactly what we want, except one thing: in address bar of a browser we still see old URL: XXX.force.com.

So, Is it possible to configure this custom URL so that we could see "www.mycompany.com" in an address bar? What should we pay attention for to implement this behavior?

Thank you. Gennadiy.

p.s. One of our assumptions is that we should do something more with CA-certificate and SSL-certificate. If anyone knows more whether they affect on the described problem or not, please push us in a right direction.
Hi Team,

Could you advise how to include the case email thread into email alert?

When there is a new email received by a case, SF has a standard function to send out a notificaiton to case owners, and in that notification it includes the customer's new email. We just need the same notification to be sent to another case related user besides the case owner, and we've set up a workflow rule to trigger an email alert. Howver, the merge field {!Case.Email_Thread} don't work in the email template and as confirmed with SF support this is not possible through standard configuration as today.

Would be appreciated if anyone can help with this by coding, thanks in advance.
Hi, as title, how can I default an email template when click 'Reply' or 'Reply All' button on Case Feed item? Basically I would like to load a simple reply signature template when users click on  'Reply' or 'Reply All' button on Case Feed email feed item.

 I understand that the Smart Templates (Enable Default Email Templates) feature allows you to drive which template is pre-loaded from any apex logic you create, but that is for when you typing a new email. I would like to load a template when click on 'Reply' or 'Reply All' button and my template will be the top of the message and follow by my 'original message'

Is that possible?
Hi i have case feed & email to case enabled  in my salesforce org. i have a situation where my customer send in email to my routing email and CC some other ppl.

In case feed, when i select answer customer the CC list member is gone, how can i remain the CC list from the original email?

And i have a email template which will load the message body -> {!EmailMessage.TextBody} but it wont load the body. any idea?

Hi,

We're attempting to make a custom email publisher for Case Feed to completely replace the standard Answer Customer publisher and we're running into severe obstacles. We must be missing something with at least some of the below issues because this is seeming very developer unfriendly. Any help is greatly appreciated.

1) The VF page added to the Feed must have a static height and apex:emailPublisher widget has elements that dynamically expand/shrink on clicks. This creates whitespace under the publisher inside the page's iframe and creates an obvious gap above the actual feed. That is, unless we use javascript to automatically control or lock element sizing. Scrollbars inside of the iframe are worse. Are there any other options here?

2) In Summer 13, if you remove the standard Answer Customer publisher from the Feed then the Reply and Reply All buttons on email feed items simply don't work. In Winter 14 under the same setup, those buttons now pull the user out of the feed and send them to the native Send Email page. Ideally, since we're trying to replace the standard publisher, we'd like those buttons to take users to our custom publisher within the feed. Another acceptable option would be for the buttons to simply be removed from the email feed items when the standard publisher isn't on the feed layout. Given this behavior with the Reply buttons, how can we possibly make it so users will default to our publisher? They'd have to consistently remember to ignore the easily accessible buttons on the emails themselves and instead always choose the proper action from the left bar.

3) If we select a custom button from the "Replace Send Email Button with" menu and use the standard Answer Publisher action then we are presented with a stripped down email publisher, which sends an email, and then redirects per the button. What is the purpose of this if the email is always sent through the standard publisher anyway regardless of the override?

Thanks.

In an email to case set up, the body of the email is set to be displayed as description in the case in salesforce.

 

This goes ugly when an email consist of a table and the data in table comes off something like this in Case Description for e.g.

 

Library Complaints Issue Information: Issue Date Location Issue Description Vandalism Aug 30 1969 12:00:00:000AM 4th floor Too many people 4th floor lobby Issuer Information: Student Number Title First Name Type StudentID22222222����������

 

Can we parse out the information on the table of email's body in some sensible manner in Case description??

 

Any insights towards the solution will be greatly appreciated.

 

Thank you!!

  • September 19, 2013
  • Like
  • 1
I have created a custom Email Publisher because I wanted to make the "To" field as Read- Only  . It works fine except -
  1. The original email conversations do not get included in the email Body when we Reply  to the email.
  2. The "Reply " and "Reply To " buttons under the emails under the All Updates section do not work
<apex:page standardController="Case" showHeader="true">
<apex:emailPublisher id="myEmailPublisher"
 entityId="{!case.id}"  width="500px" 
 title="Send an Email"
 expandableHeader="true"  autoCollapseBody="true"
 showAdditionalFields="true" 
 fromVisibility="selectable"  toVisibility="readOnly" toAddresses="{!case.contact.email}"
 bccVisibility="hidden"  ccVisibility="hidden"
 emailBody=""  emailBodyFormat="HTML"
 reRender="myEmailPublisher" subjectVisibility="editable" subject="Re:{!case.subject}"
 enableQuickText="true"
 onSubmitFailure="alert('failed');"
 fromAddresses=abc@abc.com
 showSendButton="true" sendButtonName="Send Email"  /> 
 </apex:page>

Can someone help me on this urgently

Thanks
Chhavi Vashist

 

  • December 18, 2012
  • Like
  • 1

I've modified the Web to Case form on Developerforce Quickstarts Creating Custom Web-To-Case Forms

What I've done is redirect the user to a thankyou page upon pressing the submit button.  But what I really need is for the Casenumber to be shown on the thankyou page. At the moment the casenumber does not show. I have checked the permissions and they are fine. The problem I have is how to pass the value from the first page to the thankyou page. Any help greatly appreciated.

 

Here is my page:

 

<apex:page controller="SubmitCaseController" title="Case thank you page" 
           showHeader="false" standardStylesheets="true">
  <apex:composition template="{!$Site.Template}">
  <apex:insert name="header">
    <c:SiteHeader />
    <hr/>
  </apex:insert>
    <apex:define name="body"> 
        <br/>
        <center>
        <apex:outputText value="Your information is saved.  Thank you for your interest!"/>
        <br/>
        <apex:outputText value="Your Case Reference Number is: {!c.casenumber}"/>
        </center>
        <br/>
        <br/>
    </apex:define>
  </apex:composition>
</apex:page>

 And here is the controller:

 

public class SubmitCaseController {
    
    public Case c { get; set; }
    public SubmitCaseController() {
        c = new Case();
    }
    public string casenum;
       
    
    // This method cancels the wizard, and returns the user to the  
    // Submit case page
    
    public PageReference cancel() {
			PageReference SubmitCasePage = new PageReference('/apex/SubmitCase');
			SubmitCasePage.setRedirect(true);
			return SubmitCasePage; 
    }
    
    public PageReference SubmitCase() {
        List<Contact> cons = [SELECT Id, email, AccountId, CreatedDate FROM Contact WHERE email = :c.SuppliedEmail order by CreatedDate desc];
        if (cons.size() < 1) {
            ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.WARNING, 'Please enter an email that matches our records');
            ApexPages.addMessage(msg);
            return null;
        } else {
            try {
                c.ContactId = cons.get(0).Id;
                c.AccountId = cons.get(0).AccountId;
                
                            
                // Specify DML options to ensure the assignment rules are executed
                Database.DMLOptions dmlOpts = new Database.DMLOptions();
                dmlOpts.assignmentRuleHeader.useDefaultRule = true;
                c.setOptions(dmlOpts);

                // Insert the case
                INSERT c;
                
                casenum = c.CaseNumber;             
                
                return new PageReference('/casethankyou');
                } catch (Exception e) {
                ApexPages.addMessages(e);
                return null;
            }
        }
    }
}

 

And here is the SubmitCase page:

 

<apex:page controller="SubmitCaseController" title="Submit Case" showHeader="false"
           standardStylesheets="true">
<script>
  function confirmCancel() {
      var isCancel = confirm("Are you sure you wish to cancel?");
      if (isCancel) return true;
  
     return false;
  }  
  </script>
    
    <apex:composition template="{!$Site.Template}">
    <apex:insert name="header">
    <c:SiteHeader />
    <hr/>
    </apex:insert>
    <apex:define name="body">
    <apex:form >
        <apex:messages id="error"
                   styleClass="errorMsg"
                   layout="table"
                   style="margin-top:1em;"/>
      <apex:pageBlock title="" mode="edit">
        <apex:pageBlockButtons >
           <apex:commandButton value="Submit"
                               action="{!SubmitCase}"/>
           <apex:commandButton action="{!cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true"/>
        </apex:pageBlockButtons>
        <apex:pageBlockSection title="New Enquiry"
                               collapsible="false"
                               columns="1">
        <table>
            <tr>
                <th>Customer Name:</th>
                <td>
                <apex:inputText required="true" value="{!c.SuppliedName}"/></td>
            </tr>
            <tr>
                <th>Customer Email:</th>
                <td><apex:inputText required="true" value="{!c.SuppliedEmail}"/></td>
            </tr>
            <tr>
                <th>Business Name:</th>
                <td><apex:inputText required="true" value="{!c.SuppliedCompany}"/></td>
            </tr>
            <tr>
                <th>Subject:</th>
                <td><apex:inputText required="true" value="{!c.Subject}"/></td>
            </tr>
            <tr>
                <th>Your Problem:</th>
                <td><apex:inputTextArea required="true" rows="5" value="{!c.Description}"/></td>
            </tr>
         </table>
        
        </apex:pageBlockSection>
     </apex:pageBlock>
   </apex:form>
  </apex:define> 
 </apex:composition>
</apex:page>