search.ResultSet
Object Description |
Encapsulates a set of search results returned by Search.run(). Use the methods and properties for the For a complete list of this object’s methods and properties, see ResultSet Object Members.
Important:
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. |
Supported Script Types |
Client and server scripts For more information, see SuiteScript 2.x Script Types. |
Module |
|
Since |
2015.2 |
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
...
// Load a saved search. Alternatively, you can create a search using search.create(options)
// and other methods in the N/search module.
var mySearch = search.load({
id: 'customsearch_my_cs_search'
});
// Run the search, and use ResultSet.each(callback) to define a callback function to
// execute on each search result.
//
// In this example, the saved search that was loaded above searches for Customer records.
// The Result.getValue(options) method obtains the search result value of one of the search
// columns that was specified in the search definition. Both 'entityid' and 'email' are valid
// search column names for a Customer record.
mySearch.run().each(function(result) {
var entity = result.getValue({
name: 'entityid'
});
log.debug(entity);
var email = result.getValue({
name: 'email'
});
log.debug(email);
return true;
});
...
// Add additional code