Modules

filter

 

Objects/Functions

module (N/query)

SuiteScript 2.0

Query.run()

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

N/query Module
Query.run()
Method Description: Executes the query and returns the query result set. This method returns a maximum of 5000 results in the query result set. If a query matches more than 5000 results, you must use Query.runPaged() or Query.runPaged.promise() to retrieve the full set of results.
Returns: query.ResultSet
Supported Script Types: Client and server scripts For more information, see SuiteScript 2.0 Script Types.
Governance: 10 units
Module: N/query Module
Parent Object: query.Query
Sibling Object Members: Query Object Members
Since: 2018.1
Search NetSuite - https://system.netsuite.com/app/help/helpcenter.nl?search=Query.run()

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'
}),
myCustomerQuery.createColumn({
fieldId: 'id'
}),
mySalesRepJoin.createColumn({
fieldId: 'entityid'
}),
mySalesRepJoin.createColumn({
fieldId: 'email'
}),
mySalesRepJoin.createColumn({
fieldId: 'hiredate'
})
];

myCustomerQuery.sort = [
myCustomerQuery.createSort({
column: myCustomerQuery.columns[1]
}),
mySalesRepJoin.createSort({
column: mySalesRepJoin.columns[0],
ascending: false
})
];

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

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