Modules

SuiteScript N/file Module

Using N/file Module

SuiteScript N/file module manages files in the File Cabinet.

Introduction to SuiteScript N/file Module

The SuiteScript N/file module provides a comprehensive API for managing files within NetSuite's File Cabinet. This module allows you to create, read, update, delete, and search for files, making it an essential tool for scripts that require file handling capabilities.

Loading Files

To work with files stored in the File Cabinet, you first need to load them using the load method. This method requires the internal ID of the file you wish to load.

Creating and Saving Files

Creating a new file involves specifying the file name, file type, and file content. Use the create method to initialize a new file object, and then call save to save it to the File Cabinet.

Updating Files

To update an existing file, load it first, modify its properties or contents, and then save the changes. The save method is called on the loaded file object to persist the updates.

Deleting Files

Files can be deleted using the delete method. This operation requires the internal ID of the file to be deleted.

Searching for Files

The N/file module allows you to search for files using the search method. This can be useful when you need to find files based on specific criteria.