search.load(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Loads an existing saved search and returns it as a search.Search. The saved search could have been created using the UI or created with search.create(options) and Search.save().

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

Returns

search.Search

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 load uses a standalone search type, optional otherwise

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

This parameter is required if the saved search to load uses a standalone search type. A standalone search type is a search type that does not have a corresponding record type. Typically, the search type of the saved search can be determined automatically based on the corresponding record type. In this case, this parameter is not required. For standalone search types, you must specify the search type explicitly using this parameter.

The following is a list of standalone search types:

  • DeletedRecord

  • EndToEndTime

  • ExpenseAmortPlanAndSchedule

  • RevRecPlanAndSchedule

  • GlLinesAuditLog

  • Crosschargeable

  • FinRptAggregateFR

  • BillingAccountBillCycle

  • BillingAccountBillRequest

  • BinItemBalance

  • PaymentEvent

  • Permission

  • GatewayNotification

  • TimeApproval

  • RecentRecord

  • Role

  • SavedSearch

  • ShoppingCart

  • SubscriptionRenewalHistory

  • SuiteScriptDetail

  • SupplyChainSnapshotDetails

  • SystemNote

  • TaxDetail

  • TimesheetApproval

  • Uber

  • ResAllocationTimeOffConflict

  • ComSearchOneWaySyn

  • ComSearchGroupSyn

  • Installment

  • InventoryBalance

  • InventoryNumberBin

  • InventoryNumberItem

  • InventoryStatusLocation

  • InvtNumberItemBalance

  • ItemBinNumber

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 
...
var mySearch = search.load({
    id: 'customsearch_my_so_search'
});
...
//Add additional code 

        

Related Topics

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

General Notices