Modules

filter

 

Objects/Functions

module (N/search)

SuiteScript 2.0

search.createFilter(options)

{search}.createFilter({name: {string},join: {string},operator: {string},values: {string | Date | number | boolean | string[] | Date[] | number[]},formul a: {string},summary: ${7:string}})

N/search Module
search.createFilter()
Method Description: Creates a new search filter as a search.Filter object. 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.Filter
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.createFilter(options)

Example:

// Code Example 1
// Add additional code
//...
// Create a filter joined to another record type. When you create a joined filter:
// - The name property is the field ID of the field in the joined record that you are filtering on
// - The join property is the field ID of the field in the current record that contains the record
// type you want to join to
// - The operator property is the operator to use to filter the results
// - The values property contains the values to use to filter the results
//
// For example, the following search definition lists the first 100 employees found
// who have a custom role. The search definition specifies that the search applies to
// Employee records. The filter definition joins the Role record type to the search
// and returns results where the iscustom field (a field on the Role record) is true.
var result = search.create({
type: 'employee',
columns: ['firstname', 'lastname', 'role'],
filters: [
search.createFilter({
name: 'iscustom',
join: 'role',
operator: search.Operator.IS,
values: true
})
]
}).run().getRange({
start: 0,
end: 100
});
log.debug({
title: 'Result',
details: result
});
//...
// Add additional code

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