To incorporate an email template designed for the ‘entity’ record type into a script.
let mergeResult = render.mergeEmail({
templateId: 7,
entity: {
type: 'customer',
id: customerRecId,
},
recipient: null,
supportCaseId: null,
transactionId: null,
customRecord: null
});
let emailSubject = mergeResult.subject;
let emailBody = mergeResult.body;
if (emailId) {
email.send({
author: 9691,
recipients: emailId,
subject: emailSubject,
body: emailBody,
});
}