RE: NetSuite SS 2.0 – Attach File Object to Email Being Sent Keeps getting Error “Wrong parameter type: options.attachments is expected as file.File[].”

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 = "";
var additionalRecipients = null;
var recPDF = render.transaction({

entityId: recID,

printMode: render.PrintMode.PDF,

author: author,

recipients: mainRecipient,

subject: emailSubject,

cc: additionalRecipients,

body: emailBody,

attachments: [recPDF],

relatedRecords: {

transactionId: recID


daBears38235 Rookie Asked on December 2, 2020 in SuiteScript.
Add Comment
3 Answers

I figured out my issue.  I have a library file module that I had added to my Suitelet. When I removed the library file module from the Suitelet my code worked fine. So something with the library file is conflicting.  That will be a different issue that I will need to figure out, but at least I got this working now. Thanks guys for helping me debug.

Rookie Answered on December 2, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.