Using Email Template in Apex! — Sarah on Salesforce


A method that makes apex and email templates work together! Found here: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_email_outbound_messaging.htm For the email template, I used a custom HTML template and filled it in with HTML and any merge fields for my custom object. renderStoredEmailTemplate(templateId, whoId, whatId) Example Usage: Messaging.SingleEmailMessage email = Messaging.renderStoredEmailTemplate(’00XR0000000AAAA’, null, ‘a0AR000000GAAAA’); system.debug( email.getHTMLBody()); The above will result in getting […]

via Using Email Template in Apex! — Sarah on Salesforce

Advertisements