Search.save()

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Saves a search created by search.create(options) or loaded with search.load(options). Returns the internal ID of the saved search.

You must set the title and id properties for a new saved search before you save it, either when you create it with search.create(options) or by setting the Search.title and Search.id properties.

If you do not set the saved search ID, NetSuite generates one for you. See Search.id.

Note:

You do not need to set these properties if you load a previously saved search with search.load(options) and then save it.

This method also includes a promise version, Search.save.promise(). For more information about promises, see Promise Object.

Returns

the internal search ID of the saved search as a number

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

Errors

Error Code

Message

Thrown If

NAME_ALREADY_IN_USE

A search has already been saved with that name. Please use a different name.

The Search.title property on search.Search is not unique.

SSS_DUPLICATE_SEARCH_SCRIPT_ID

Saved search script IDs must be unique. Please choose another script ID. If you are trying to modify an existing saved search, use search.load().

The Search.id property on search.Search is not unique.

SSS_MISSING_REQD_ARGUMENT

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

Required Search.title property not set on search.Search.

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
...
  const mySalesOrderSearch = search.create({
    type: search.Type.SALES_ORDER,
    title: 'My SalesOrder Search',
    id: 'customsearch_my_so_search',
    columns: ['entity', 'subsidiary', 'name', 'currency'],
    filters: [
      ['mainline', 'is', 'T'], 'and', ['subsidiary.name', 'contains', 'CAD']
    ]
  })
  
  mySalesOrderSearch.save() // returns search ID

...
//Add additional code 

        

Related Topics

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

General Notices