Adding Email Template in script.

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,
                });
            }

Leave a comment

Your email address will not be published. Required fields are marked *