ResultSet.each.promise(callback)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Asynchronously uses 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);

Note:

The parameters and errors thrown for this method are the same as those for ResultSet.each(callback). For more information about promises, see Promise Object.

Returns

Promise Object

Synchronous Version

ResultSet.each(callback)

Supported Script Types

Client scripts

For more information, see SuiteScript 2.x Client Script Type.

Governance

10 units

Module

N/search Module

Since

2015.2

Syntax
Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete promise script example, see Promise Object.

          //Add additional code 
...
mySearch.run().each.promise(function(result) {
    var entity = result.getValue({
        name: 'entity'
    });
    var subsidiary = result.getValue({
        name: 'subsidiary'
    });
    return true;
})
    .then(function(response){
        log.debug({
            title: 'Completed',
            details: response
        });
    })
    .catch(function onRejected(reason) {
        log.debug({
            title: 'Failed: ',
            details: reason
        });
    })
...
//Add additional code 

        

Related Topics

search.ResultSet
N/search Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices