Tuesday, December 29, 2020

 N/file Module

Load the file module when you want to work with files within NetSuite. You can use this module to upload files to the NetSuite File Cabinet. You can also use this module to send files as attachments without uploading them to the File Cabinet.

Create and save a file

 function createAndSaveFile() {
 var fileObj = file.create({
 name: 'test.txt',
 fileType: file.Type.PLAINTEXT,
 contents: 'Welcome to Netsuite technical learning'
 });
 fileObj.folder = -15;
 var id = fileObj.save();
 fileObj = file.load({
 id: id
 });
 }

1. First we need to import the File module.
2. Now by using file.create method create a file object.
3. name: Its filename 
    fileType: We need to give file formats like plain text, CSV, etc.
    contents: means what you want to put in the file.
4. specify the file cabinet folder id.
5. finally by using a save method save the file in the file cabinet.

 N/file Module Load the file module when you want to work with files within NetSuite. You can use this module to upload files to the NetSuit...