Set Email Template in a Script

To set an email template in a script to send an email, we need to create the email template through NetSuite UI.

Then we need to load the template and get the contents of the template.

Then set the contents of the template to the email body.

let emailTemplate = record.load(

{

type: record.Type.EMAIL_TEMPLATE,

        id: emailTemplateId

});

let content = emailTemplate.getValue(

{

fieldId: ‘content’

});

email.send(

{

author: authorId’,

        recipients: recipientld,

        subject: ‘ EMAIL SUBJECT ‘,

        body: content,

});

Leave a comment

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