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:
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
Important:
The work done in the context of the callback function counts toward 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 place the entire script at risk of exceeding scheduled script governance limits. |
Returns |
void |
Supported Script Types |
Client and server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
10 units |
Module |
|
Since |
2015.2 |
Parameters
The options parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
---|---|---|---|
callback |
function |
required |
Named JavaScript function or anonymous inline function that contains the logic to process a search.Result object. |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/search Module Script Samples.
//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