Options in email.send

The following code can be used to attach the Pdf of the transaction record to the email as an attachment and set the subject and body of the email using an email template.

Create transaction PDF

let transactionFile = render.transaction({

   entityId: recordId,

   printMode: render.PrintMode.PDF,

   inCustLocale: true

});

save the file to file cabinet

transactionFile.folder = 1511388;

let fileId = transactionFile.save();

load file from file cabinet

let pdfAttachment = file.load({

   id: fileId

});

Get the subject and body from the email template

let myMergeResult1 = render.mergeEmail({

  templateId: TemplateId,

});

Send email action

email.send({

   author: employeeId,

    recipients: emailReceipient,

  subject: myMergeResult.subject,

  body: myMergeResult.body,

   attachments: [pdfAttachment],

});

Leave a comment

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