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

Agentforce metadata types for deployment

 Hi, The following are key metadata types to consider when deploying Prompt Templates, Topics, Agent Actions, and Agents in Salesforce. <...