Modules

filter

 

Objects/Functions

module (N/query)

SuiteScript 2.0

ResultSet.asMappedResults()

// Please search https://system.netsuite.com/app/help/helpcenter.nl?search=ResultSet.asMappedResults() for more information.

N/query Module
ResultSet.asMappedResults()
Method Description: Returns the query result set as an array of mapped results. A mapped result is a JavaScript object with key-value pairs. In this object, the key is either the field ID or the alias that was used for the corresponding query.Column object. When you call this method, Result.asMap() is called on each query.Result object in the result set.
Returns: Object[]
Supported Script Types: Client and server scripts For more information, see SuiteScript 2.0 Script Types.
Governance: None
Module: N/query Module
Parent Object: query.ResultSet
Sibling Object Members: ResultSet Object Members
Since: 2019.2
Search NetSuite - https://system.netsuite.com/app/help/helpcenter.nl?search=ResultSet.asMappedResults()

Example:

// Code Example 1
// Add additional code
//...
var myCustomerQuery = query.create({
type: query.Type.CUSTOMER
});

var mySalesRepJoin = myCustomerQuery.autoJoin({
fieldId: 'salesrep'
});

myCustomerQuery.columns = [
myCustomerQuery.createColumn({
fieldId: 'entityid',
alias: 'cust'
}),
myCustomerQuery.createColumn({
fieldId: 'id'
}),
mySalesRepJoin.createColumn({
fieldId: 'entityid'
}),
mySalesRepJoin.createColumn({
fieldId: 'email'
}),
mySalesRepJoin.createColumn({
fieldId: 'hiredate'
})
];

var resultSet = myCustomerQuery.run();
var mrSet = resultSet.asMappedResults();
//...
// Add additional code

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