query.Result
Object Description |
A single row of the result set (query.ResultSet). |
Supported Script Types |
Client and server scripts For more information, see SuiteScript 2.x Script Types. |
Module |
|
Methods and Properties |
|
Since |
2018.1 |
Syntax
Important:
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/query Module Script Samples.
// Add additional code
...
var myCustomerQuery = query.create({
type: query.Type.CUSTOMER
});
myCustomerQuery.columns = [
myCustomerQuery.createColumn({
fieldId: 'entityid'
}),
myCustomerQuery.createColumn({
fieldId: 'firstname'
}),
myCustomerQuery.createColumn({
fieldId: 'email'
})
];
var queryResultSet = myCustomerQuery.run();
// Fetch results using an iterator
var iterator = queryResultSet.iterator();
iterator.each(function(result) {
var currentResult = result.value;
log.debug(currentResult);
return true;
});
// Alternatively, fetch results using a loop
var queryResults = queryResultSet.results;
for (var i = 0; i < queryResults.length; i++) {
var currentResult = queryResults[i];
log.debug(currentResult);
}
...
// Add additional code