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


As a quick test, could you try this:

attachments: recPDF,



Intermediate Answered on December 2, 2020.

When I try it that way, I get the following error:

“Wrong parameter type: options.attachments is expected as Array. “

on December 2, 2020.
Add Comment

Your Answer

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