I am writing a script where I am trying to print a transaction and then email it. I keep getting the following error.
“Wrong parameter type: options.attachments is expected as file.File[].”
I can’t tell what is wrong with my code. Here is the snipped of code that is causing the issues. The email sends just fine if I don’t include the attachments parameter. Any help would be greatly appreciated.
var recID = 1213;
var userID = 1478;
var emailSender = 1478;
var emailSubject = "Test Email";
var emailBody = "This is a test.";
var mainRecipient = "test@test.com";
var additionalRecipients = null;
var recPDF = render.transaction({
entityId: recID,
printMode: render.PrintMode.PDF,
});
email.send({
author: author,
recipients: mainRecipient,
subject: emailSubject,
cc: additionalRecipients,
body: emailBody,
attachments: [recPDF],
relatedRecords: {
transactionId: recID
}
});