query.runSuiteQL(options)
Method Description |
Runs an arbitrary SuiteQL query. SuiteQL is a query language based on the SQL-92 revision of the SQL database query language. It provides advanced query capabilities you can use to access your NetSuite records and data. You can specify the SuiteQL query as one of the following:
Note:
This method can return a maximum of 5000 results. If you need to return more results, use query.runSuiteQLPaged(options) instead. For more information and examples of using SuiteQL in the N/query module, see SuiteQL in the N/query Module. For more information about SuiteQL in general, see SuiteQL. |
Returns |
|
Supported Script Types |
Client and server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
10 units |
Module |
|
Sibling Module Members |
|
Since |
2020.1 |
Parameters
The options
parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
---|---|---|---|
|
string |
required |
The string representation of the SuiteQL query to run. |
|
<string | number | > |
optional |
The parameters to use in the SuiteQL query. |
|
string |
optional |
A unique identifier used for potential performance issues in a query. If your query produces performance issues, the custom script ID identifies where the update will need to occur. This ID can also be used as a precaution to speed up performance fixes, if necessary.
Note:
The Script ID must be unique or the performance enhancements will affect each query with the same customScriptID. |
Errors
Error Code |
Thrown If |
---|---|
|
The parameter is missing. |
|
Types other than string, number, or are included in the |
Syntax
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 results = query.runSuiteQL({
query: 'SELECT customer.entityid, customer.email FROM customer WHERE customer.isperson = ?',
params: [true],
customScriptId: 'myCustomScriptId'
});
...
// Add additional code