search.delete(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Deletes an existing saved search. The saved search could have been created using the UI or created with search.create(options) and Search.save().

The search.delete(options) method also includes a promise version, search.delete.promise(options). For more information about promises, see Promise Object.

Returns

void

Supported Script Types

Client and server scripts

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

Governance

5 units

Module

N/search Module

Since

2015.2

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

options.id

string

Required

Internal ID or script ID of a saved search. The script ID starts with customsearch. See Search.id.

2015.2

options.type

string

Required if the saved search to delete uses a standalone search type, optional otherwise

The search type of the saved search to delete. Use a value from the search.Type enum for this parameter.

To successfully delete a standalone search, this parameter is required to avoid an error being thrown. For more information about standalone search types, see search.load(options).

2015.2

Errors

Error Code

Message

Thrown If

INVALID_SEARCH

That search or mass update does not exist.

Cannot find saved search with the saved search ID from options.id parameter.

SSS_MISSING_REQD_ARGUMENT

{1}: Missing a required argument: {2}

Required parameter is missing.

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/search Module Script Samples.

          //Add additional code
...
search.delete({
    id: 'customsearch_my_so_search'
});
...
//Add additional code 

        

Related Topics

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

General Notices