Thursday, 28 November 2019

Prepare email message with Template using renderStoredEmailTemplate method

Hi ,



When we have to use email template then we have to use few methods like "setTemplateId" ,"setWhatId" etc.


But we can use single method "renderStoredEmailTemplate"to  prepare the message from email template. We have to be careful when we use this method because it counts SOQL query.


Eg:

Messaging.SingleEmailMessage message = Messaging.renderStoredEmailTemplate(templateid,whoId,whatId);
message.setsaveAsActivity(false);
Messaging.sendEmail(new List<Messaging.Email>{message});




Reference:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_email_outbound_messaging.htm

What’s the difference between Einstein Article Recommendations and Suggested Articles?

How Does Einstein Article Recommendations Work? Einstein Article Recommendations helps support agents resolve customer cases efficiently by ...