I am sending an email message to the case contact after creating the case. I am sending this Email through apex trigger.
But this email message is not shown in console case feed. I am sending another email message when case comment is added through apex trigger and that Email message is get displayed on case feed.

Could you please explain why this is happening??

    Code :

if(Trigger.isAfter && Trigger.isInsert){
  List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
  set<id> CaseSet = new set<id>();
  OrgWideEmailAddress owa = [select id, DisplayName, Address from OrgWideEmailAddress where DisplayName = 'test'];
  EmailTemplate template = [SELECT Id, DeveloperName FROM EmailTemplate WHERE DeveloperName='Initial_Response_Email'];
  list<string> Addresscc = new list<string>{'[email protected]'};
     for(case c : trigger.new){
        Messaging.SingleEmailMessage msg = new Messaging.SingleEmailMessage();


  • Do you receive the email sent by the trigger? If so, can you post the code that is responsible for this action? Commented Feb 14, 2018 at 12:19
  • Post your code and make sure you have case thread Id somewhere in the email Commented Feb 14, 2018 at 12:27
  • Yes Contact is getting email but it's not shown in case feed in console
    – user49343
    Commented Feb 14, 2018 at 13:27
  • 3
    I believe you need to create the EmailMessage record against the Case in order for it to appear against the Case record.
    – Girbot
    Commented Feb 14, 2018 at 16:07
  • Thanks for your reply. But I have written trigger on case comment object with the same logic which i have used here. Email is sent when case comment is added and that Email comes under the related list for case object without creating the Email message record.
    – user49343
    Commented Feb 15, 2018 at 6:50


You must log in to answer this question.

Browse other questions tagged .