Query.toSuiteQL()
Method Description |
Converts this query.Query object to its corresponding SuiteQL representation. This method returns a query.SuiteQL object that represents the same query as the original query.Query object. This object includes the SuiteQL.columns, SuiteQL.params, SuiteQL.query, and SuiteQL.type properties. You can run the query using SuiteQL.run(), or you can run the query as a paged query using SuiteQL.runPaged(options).
Important:
The resulting SuiteQL query string (contained in the SuiteQL.query property) does not include any aliases you set on query result columns in the original query.Query object. For more information about aliases, see Column.alias. 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 |
None |
Module |
|
Parent Object |
|
Sibling Object Members |
|
Since |
2020.1 |
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
...
// myQuery is an existing query.Query object
var mySuiteQLQuery = myQuery.toSuiteQL();
var results = mySuiteQLQuery.run();
...
// Add additional code