I am working on a Round robin record assignment on case object and I need to notify the contacts noted on the case with the new case owner details after case assignment. I have tried with workflows but it didn't worked out. So I have written a single email message class with custom html template in trigger to send an email to contact noted on case. So I am receiving the template as HTML but my client want it with my company letterhead.

So could someone please let me know how can we populate dynamic values to a Html template with letterhead

Also I have tried to replace the values on existing HTML template with Letterhead even though I am unable to get the letterhead instead able to see a blank at the top followed by HTML message

Any thoughts would be highly appreciated...!!!

It's part of a trigger:

 for(case cm : [select id, CaseNumber, Subject, Priority,
                       Preferred_Language__c, contact.Name,ContactEmail 
                from case
                where ID IN :Emaillist.keySet()])
        system.debug('case list for email' + cm);
        for(User Un : Eulist)
            if(Emaillist.get(cm.id) == un.id)
                Messaging.SingleEmailMessage sm = new Messaging.SingleEmailMessage();
                String[] toAddresses = new String[] {cm.ContactEmail};
                sm.setSubject('Your Request was started/updated - ref' + cm.CaseNumber);
                String body = '<b>Dear'+ ' '+ cm.contact.Name +'</b>,<br>';
                body += '<p> We are pleased to inform you that the Incident you reported has <br>';
                body += 'been successfully entered into the ticketing <br>';
                body += 'system. Your assigned Reference Number is'+' '+ cm.CaseNumber +'. This<br>';
                body += 'number should be retained for reference purposes. A support <br>';
                body += 'engineer has claimed your case and will contact you as soon as possible.</p> <br>';
                body += 'Reference Number:'+' '+cm.CaseNumber +'<br>';
                body +=     'Assigned To :' +' '+  Un.Name +'<br>';
                body +=    'Mail Address :' +' '+ Un.Email +'<br>';
                body +=       'Telephone :' +' '+ Un.Phone +'<br>';
                body +=          'Subject:' + ' '+cm.Subject +'<br>';
                body +=         'Priority:' + ' '+cm.Priority +'<br> ';
                body +=   'Contact Method:' +' '+ cm.Contact_Method__c +'<br>';
                body +='Preferred Language:'+' '+cm.Preferred_Language__c +'<br>';
                body +=      'Description:' +' '+cm.Description+'<br>';
  • What's the issue? – Samir Feb 24 '17 at 2:48
  • contacts receiving the email as plain text template even though I have used setHtmlBody and also my client wants this template to look like HTML with my company letterhead. So I am unable to merge both HTML and Letter head by passing the dynamic user values to it. – vamshi krishna Feb 24 '17 at 7:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.