N/search Module
Use the N/search module to create and run on-demand or saved searches and analyze and iterate through the search results. You can use this module to do the following:
-
Search for a single record using keywords
-
Create and save searches
-
Load and run previously saved searches
-
Search for duplicate records
-
Return a set of records that match filter criteria you define
You can also paginate search results and construct navigation that jumps between the next and previous pages. Due to the performance benefits, this is a suitable approach for working with a large result set.
In This Help Topic
N/search Module Members
Member Type |
Name |
Return Type / Value Type |
Supported Script Types |
Description |
---|---|---|---|---|
Object |
Object |
Client and server scripts |
Encapsulates a single search column in a search.Search object. Use the methods and properties available to the Column object to get or set Column properties. |
|
Object |
Client and server scripts |
Encapsulates a search filter used in a search. Use the properties for the Filter object to get and set the filter properties. |
||
Object |
Client and server scripts |
Encapsulates a set of search results for a single search page. |
||
Object |
Client and server scripts |
Holds metadata about a paginated query. |
||
Object |
Client and server scripts |
Defines the page range to bound the result set for a paginated query. |
||
Object |
Client and server scripts |
Encapsulate a single search result row. Use the methods and properties for the Result object to get the column values for the result row. |
||
Object |
Client and server scripts |
Encapsulates a set of search results returned by Search.run(). |
||
Object |
Client and server scripts |
Encapsulates a NetSuite search. Use the methods available to the Search object to create a search, run a search, or save a search. |
||
Object |
Client and server scripts |
Encapsulates a search setting. Search settings let you specify search parameters that are typically available only in the UI. |
||
Method |
Client and server scripts |
Creates a new search and returns it as a search.Search object. |
||
Client and server scripts |
Creates a new search asynchronously and returns it as a search.Search object. |
|||
Client and server scripts |
Creates a new search column as a search.Column object. |
|||
Client and server scripts |
Creates a new search filter as a search.Filter object. |
|||
Client and server scripts |
Creates a new search setting and returns it as a search.Setting object. |
|||
void |
Client and server scripts |
Deletes an existing saved search asynchronously and returns it as a search.Search object. |
||
void |
Client and server scripts |
Deletes an existing saved search and returns it as a search.Search object. |
||
Client and server scripts |
Performs a search for duplicate records based on the duplicate detection configuration for the account. Returns an array of search.Result objects. |
|||
Client and server scripts |
Performs a search for duplicate records asynchronously based on the duplicate detection configuration for the account. Returns an array of search.Result objects. |
|||
Client and server scripts |
Performs a global search against a single keyword or multiple keywords. |
|||
Client and server scripts |
Performs a global search asynchronously against a single keyword or multiple keywords. |
|||
Client and server scripts |
Loads an existing saved search and returns it as a search.Search object. |
|||
Client and server scripts |
Loads an existing saved search asynchronously and returns it as a search.Search object. |
|||
Object | array |
Client and server scripts |
Performs a search for one or more body fields on a record. Returns select fields as an object with value and text properties. Returns multiselect fields as an object with value:text pairs. |
||
Object | array |
Client and server scripts |
Performs a search asynchronously for one or more body fields on a record. Returns select fields as an object with value and text properties. Returns multiselect fields as an object with value:text pairs. |
||
Enum |
enum |
Client and server scripts |
Enumeration that holds the values for search operators to use with the search.Filter object. |
|
enum |
Client and server scripts |
Holds the values for supported sorting directions used with search.createColumn(options). |
||
enum |
Client and server scripts |
Holds the values for summary types used by the Column.summary object. |
||
enum |
Client and server scripts |
Holds the string values for search types supported in the N/search Module. This enum is used to pass the type argument to search.create(options). |
Column Object Members
The following members are available for a search.Column object.
Member Type |
Name |
Return Type / Value Type |
Supported Script Types |
Description |
---|---|---|---|---|
Method |
Client and server scripts |
Returns the search column for which the minimal or maximal value should be found when returning the search.Column value. |
||
Property |
string |
Client and server scripts |
Formula used for a search column as a string. |
|
string |
Client and server scripts |
Special function used in the search column as a string. |
||
string (read-only) |
Client and server scripts |
Join ID for a search column as a string. |
||
string |
Client and server scripts |
Label used for the search column. You can only get or set custom labels with this property. |
||
string (read-only) |
Client and server scripts |
Name of a search column as a string. |
||
string (read-only) |
Client and server scripts |
Returns the summary type for a search column. |
Filter Object Members
The following members are available for a search.Filter object.
Member Type |
Name |
Return Type / Value Type |
Supported Script Types |
Description |
---|---|---|---|---|
Property |
string |
Client and server scripts |
Formula used by the search filter. |
|
string (read-only) |
Client and server scripts |
Join ID for the search filter. |
||
string (read-only) |
Client and server scripts |
Name or internal ID of the search field. |
||
string (read-only) |
Client and server scripts |
Operator used for the search filter. |
||
Client and server scripts |
Summary type for the search filter. |
Page Object Members
The following members are available for a search.Page object.
Member Type |
Name |
Return Type / Value Type |
Supported Script Types |
Description |
---|---|---|---|---|
Method |
void |
Client and server scripts |
Gets the next segment of data from a paginated search |
|
void |
Client scripts |
Asynchronously gets the next segment of data from a paginated search |
||
void |
Client and server scripts |
Gets the previous segment of data from a paginated search |
||
void |
Client scripts |
Asynchronously gets the previous segment of data from a paginated search |
||
Property |
Client and server scripts |
The results from a paginated search. |
||
boolean (read-only) |
Client and server scripts |
Indicates whether a page is the first page of data for a result set |
||
boolean (read-only) |
Client and server scripts |
Indicates whether a page is the last page of data for a result set. |
||
search.PagedData (read-only) |
Client and server scripts |
The |
||
search.PageRange (read-only) |
Client and server scripts |
The |
PagedData Object Members
The following members are available for a search.PagedData object.
Member Type |
Name |
Return Type / Value Type |
Supported Script Types |
Description |
---|---|---|---|---|
Method |
Client and server scripts |
Retrieves the data within the specified page range. |
||
Client scripts |
Asynchronously retrieves the data within the specified page range. |
|||
Property |
number (read-only) |
Client and server scripts |
The total number of results when Search.runPaged(options) was executed. |
|
search.PageRange[] (read-only) |
Client and server scripts |
The collection of PageRange objects that divide the entire result set into smaller groups. |
||
number (read-only) |
Client and server scripts |
The maximum number of entries per page |
||
search.Search (read-only) |
Client and server scripts |
The search criteria used when Search.runPaged(options) was executed. |
PageRange Object Members
The following members are available for a search.PageRange object.
Member Type |
Name |
Return Type / Value Type |
Supported Script Types |
Description |
---|---|---|---|---|
Property |
string (read-only) |
Client and server scripts |
Human-readable label with beginning and ending range identifiers |
|
number (read-only) |
Client and server scripts |
The index of this page range. |
Result Object Members
The following members are available for a search.Result object.
Member Type |
Name |
Return Type / Value Type |
Supported Script Types |
Description |
---|---|---|---|---|
Method |
string |
Client and server scripts |
The text value for a search.Column if it is a stored select field. |
|
string |
Client and server scripts |
The UI display name, or text value, for a search result column. This method is supported only for non-stored select, image, and document fields. |
||
string |
Client and server scripts |
Used on formula fields and non-formula (standard) fields to get the value of a specified search return column. |
||
string |
Client and server scripts |
Used on formula and non-formula (standard) fields. Returns the string value of a specified search result column. For convenience, this method takes a single search.Column Object. |
||
Property |
Client and server scripts |
Array of search.Column objects that encapsulate the columns returned in the search result row. |
||
string (read-only) |
Client and server scripts |
The internal ID for the record returned in a search result row. |
||
string (read-only) |
Client and server scripts |
The type of record returned in a search result row. |
ResultSet Object Members
The following members are available for a search.ResultSet object.
Member Type |
Name |
Return Type / Value Type |
Supported Script Types |
Description |
---|---|---|---|---|
Method |
void |
Client and server scripts |
Use a developer-defined function to invoke on each row in the search results, up to 4000 results at a time. |
|
void |
Client scripts |
Asynchronously use a developer-defined function to invoke on each row in the search results, up to 4000 results at a time. |
||
Client and server scripts |
Retrieve a slice of the search result as an array of search.Result objects. |
|||
Client scripts |
Asynchronously retrieve a slice of the search result as an array of search.Result objects. |
|||
Property |
Client and server scripts |
An array of search.Column objects that represent the columns returned in the search results. |
Search Object Members
The following members are available for a search.Search object.
Member Type |
Name |
Return Type / Value Type |
Supported Script Types |
Description |
---|---|---|---|---|
Method |
Client and server scripts |
Runs an on demand search created with search.create(options) or a search loaded with search.load(options), returning the results as a search.ResultSet. |
||
Client and server scripts |
Runs the current search and returns a search.PagedData Object. |
|||
Client and server scripts |
Asynchronously runs the current search and returns a search.PagedData Object. |
|||
number |
Client and server scripts |
Saves a search created by search.create(options) or loaded with search.load(options). Returns the internal ID of the saved search. |
||
number |
Client and server scripts |
Asynchronously saves a search created by search.create(options) or loaded with search.load(options). Returns the internal ID of the saved search. |
||
Property |
search.Column[] | string[] |
Client and server scripts |
Columns to return for this search as an array of search.Column objects or a string array of column names. |
|
Object[] |
Client and server scripts |
Search filter expression for the search as an array of expression objects. |
||
Client and server scripts |
Filters for the search as an array of search.Filter objects. |
|||
string |
Client and server scripts |
Script ID for a saved search, starting with |
||
boolean |
Client and server scripts |
Value is |
||
string |
Client and server scripts |
The application ID for the search. |
||
number |
Client and server scripts |
Internal ID of a search. |
||
string |
Client and server scripts |
Search type on which a search is based. |
||
search.Setting[] | string[] |
Client and server scripts |
Search settings for this search as an array of search.Setting objects or a string array of column names. |
||
string |
Client and server scripts |
Title for a saved search. Use this property to set the title for a search before you save it for the first time. |
Setting Object Members
The following members are available for a search.Setting object.
Member Type |
Name |
Return Type / Value Type |
Supported Script Types |
Description |
---|---|---|---|---|
Property |
string (read-only) |
Client and server scripts |
The name of the search parameter. |
|
string (read-only) |
Client and server scripts |
The value of the search parameter. |