Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
Now is the time to ask your NetSuite-savvy friends and colleagues to join the NetSuite Support Community! Refer now! Click here to watch and learn more!
Cant create file via suitescript 2.0
Hello,
Just wondering if anyone else has seen this.
I'm trying to create a file via a restlet with the following code:
require(['N/file'], function (file) {
var fileRequest = {
name: 'test' + '.txt',
fileType: file.Type.PLAINTEXT,
contents: 'test',
encoding: file.Encoding.UTF_8,
description: 'test',
folder: 165
};
try{
var file = file.create(fileRequest);
}
catch(ex){
debugger;
}
var fileId = file.save();
});
But everytime i run this i recieve an error with the following message: 'Unexpected Error'.
1