file.delete(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Method used to delete an existing file from the NetSuite File Cabinet.

Returns

void

Supported Script Types

Server scripts

For more information, see SuiteScript 2.x Script Types.

Governance

20 units

Module

N/file Module

Since

2015.2

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

options.id

number | string

required

  • Internal ID of the file.

  • To find the internal ID of the file in the UI, click Documents > Files > File Cabinet.

2015.2

Errors

Error Code

Message

Thrown If

SSS_MISSING_REQD_ARGUMENT

<name of missing parameter>

A required argument is not passed.

Syntax
Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/file Module Script Samples.

          //Add additional code 
...
var fileObj = file.create({
    name: 'test.txt',
    fileType: file.Type.PLAINTEXT,
    contents: 'Hello World\nHello World'
    });
fileObj.folder = 30;
var fileId = fileObj.save();

file.delete({
    id: fileId
});
...
 //Add additional code 

        

Related Topics

N/file Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices