Modules

filter

 

Objects/Functions

module (N/search)

SuiteScript 2.0

search.create(options)

{search}.create({type: {string},filters: {search.Filter | search.Filter[] | Object | Object[] | string | string[]},filterExpression: {Object[]},columns: {search.Column | search.Column[] | Object | Object[] | string | string[]},packageId: {string},settings: ${7:search.Setting | search.Setting[] | Object | Object[] | string | string[]},title: ${8:string},id: ${9:string},isPublic: {0:boolean}})

N/search Module
search.create()
Method Description: Creates a new search and returns it as a search.Search object. The search can be modified and run as an on demand search with Search.run(), without saving it. Alternatively, calling Search.save() will save the search to the database, so it can be reused later in the UI or loaded with search.load(options). This method is agnostic in terms of its options.filters argument. It can accept input of a single search.Filter object, an array of search.Filter objects, or a search filter expression. The search.create(options) method also includes a promise version, search.create.promise(options). For more information about promises, see Promise Object. When you use this method to create a search, consider the following: When you define the search, make sure you sort using the field with the most unique values, or sort using multiple fields. Sorting with a single field that has multiple identical values can cause the result rows to be in a different order each time the search is run. You cannot directly create a filter or column for a list/record type field in SuiteScript by passing in its text value. You must use the field’s internal ID. If you must use the field’s text value, you can create a filter or column with a formula using name: 'formulatext'.
Returns: search.Search
Supported Script Types: All script types For more information, see SuiteScript 2.0 Script Types.
Governance: None
Module: N/search Module
Since: 2015.2
Search NetSuite - https://system.netsuite.com/app/help/helpcenter.nl?search=search.create(options)

Example:

// Code Example 1
//Add additional code
//...
var mySalesOrderSearch = search.create({
type: search.Type.SALES_ORDER,
title: 'My Second SalesOrder Search',
id: 'customsearch_my_second_so_search',
columns: [{
name: 'entity'
}, {
name: 'subsidiary'
}, {
name: 'name'
}, {
name: 'currency'
}],
filters: [{
name: 'mainline',
operator: 'is',
values: ['T']
}],
settings: [{
name: 'consolidationtype',
value: 'AVERAGE'
}]
});
//...
//Add additional code

//SOURCE: https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4345171487.html