Modules

filter

 

Objects/Functions

module (N/search)

SuiteScript 2.0

ResultSet.each(callback)

{ResultSet}.each(callback){callback: {function}})

N/search Module
ResultSet.each(callback)
Method Description: Use a developer-defined function to invoke on each row in the search results, up to 4000 results at a time. The callback function must use the following signature: boolean callback(result.Result result); The callback function takes a search.Result object as an input parameter and returns a boolean which can be used to stop the iteration with a value of false, or continue the iteration with a value of true. The work done in the context of the callback function counts towards the governance of the script that called it. For example, if the callback function is running in the context of a scheduled script, which has a 10,000 unit governance limit, make sure the amount of processing within the callback function does not put the entire script at risk of exceeding scheduled script governance limits.
Returns: void
Supported Script Types: All script types For more information, see SuiteScript 2.0 Script Types.
Governance: 10 units
Module: N/search Module
Since: 2015.2
Search NetSuite - https://system.netsuite.com/app/help/helpcenter.nl?search=ResultSet.each(callback)

Example:

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

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