RE: Can the N/file Module Be Used in a Client Script

I’m trying to create a CSV file within a client script, but I keep getting the following error saying the module does not exist.

Fail to evaluate script: {“type”:”error.SuiteScriptModuleLoaderError”,”name”:”MODULE_DOES_NOT_EXIST”,”message”:”Module does not exist: N/file.js”,”stack”:[]}

Here’s my define statement. I don’t see a typo.

RE: Can the N/file Module Be Used in a Client Script

Does the file module not work in a client script?

mmascitto Beginner Asked on September 26, 2019 in SuiteScript.
Add Comment
1 Answers

No, N/file Module members are all server-side (/app/help/helpcenter.nl?fid=section_4205693274.html)

If you wanted to do file operations via Client script, you would need to push this functionality using a server-side script type such as Suitelet.

Intermediate Answered on September 26, 2019.

Ok, gotcha. I’m trying to create the file so I can send it in an email. It looks like I can use N/email in the client script. Would I be able to have the suitelet create the file and return the ID so I can attach it to the email?

on September 26, 2019.

the attachments parameter of email.send() action uses file.File, so you just need to create the File object you do not have to save it.  (/app/help/helpcenter.nl?fid=section_4358681681.html)

on September 27, 2019.

Ok, thanks!

on September 27, 2019.
Add Comment

Your Answer

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