module function · N/query
create()
query.create(options)
Creates the query definition.
- Implementation
- Implemented published in npm 0.0.1
- Design
- Accepted
query T where ...
1query.create({2 type: /* string, required */,3 columns: /* Object[], optional */,4 condition: /* Object, optional */,5 sort: /* Object[], optional */6});
| Parameter | Type | Required | Description |
|---|---|---|---|
| options.type | string | required | The query type that you want to use for the initial query definition. Use the query.Type enum to set this value (for an example, see Syntax ). When you perform query.create(options) , the Query.type property is set based on this value. Important: The N/query module supports the same record types that are supported by the SuiteAnalytics Workbook interface. For more information, see Available Record Types . |
| options.columns | Object[] | optional | An array of objects to be used as query columns. If you specify a value for this parameter, the Query.createColumn(options) method is called on each object in the. Important: You must include a query.Column object in your query definition to avoid scripting errors. This object is an optional parameter with the query.create(options) method, but at least one Column must be created for every query definition. For more information, see the syntax example below. |
| options.condition | Object | optional | A condition for the query. If you specify a value for this parameter, the Query.createCondition(options) method is called on the object you specify. |
| options.sort | Object[] | optional | An array of objects representing sort options. If you specify a value for this parameter, the Query.createColumn(options) and Query.createSort(options) methods are called on each object in the . |
Supported syntax · compiles today
1let customers = query Customer2 where email !== ""
1const customers = mynt$query(query.Type.CUSTOMER, ["id", "email"], (q) =>2 q.createCondition({3 fieldId: "email",4 operator: query.Operator.EMPTY_NOT5 })6);
mynt$query is a helper the compiler emits once per file. It calls query.create, requests only the fields the program reads, and collects every page of runPaged. Published on npm since 0.0.1. === and !== since 0.1.0; 0.0.1 spelled comparisons == and !=. Verified with mynt build on 13 Oct 2026.
Competing syntax for create, from GitHub Discussions. Select two or more to compare them side by side, with the syntax Mynt supports today as a baseline.
let customers = query CustomerLoading proposals from GitHub…
Write the Mynt you wish you could write.
A good proposal shows the syntax, the SuiteScript it should become, and argues for it: why it is clearer, how it fits the rest of the language, what it makes harder.
- Clarity. Does it say what happens, without ceremony?
- Consistency. Does it read like
load,saveandRef[field]? - Expressiveness. Does it cover the cases people actually write?
- Honesty. Does it hide a NetSuite cost, such as governance, that a reader should see?