Modules

filter

 

Objects/Functions

module (N/search)

SuiteScript 2.0

Search.run()

// Please search https://system.netsuite.com/app/help/helpcenter.nl?search=Search.run() for more information.

N/search Module
Search.run()
Method Description: 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. Calling this method does not save the search. Use this method with search.create(options) to create and run on-demand searches that are never saved to the database. After you run a search, you can use ResultSet.each(callback) to iterate through the result set and process each result. When you call this method, consider the following: Search result sets are not cached. If records applicable to your search are created, modified, or deleted at the same time you are traversing your result set, your result set may change. For better performance, consider creating a saved search in the UI and loading it in your script using search.load(options) instead of creating the search directly in your script using search.create(options).
Returns: search.ResultSet
Governance: None
Module: N/search Module
Since: 2015.2
Search NetSuite - https://system.netsuite.com/app/help/helpcenter.nl?search=Search.run()

Example:

// Code Example 1
//Add additional code
//...
function loadAndRunSearch() {
var mySearch = search.load({
id: 'customsearch_my_so_search'
});
mySearch.run().each(function(result) {
var entity = result.getValue({
name: 'entity'
});
var subsidiary = result.getValue({
name: 'subsidiary'
});
return true;
});
}

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