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 ...
Proposals
A
Signature
query.create(options)
Module
N/query
Returns
query.Query
Governance
None
Script types
Client and server scripts
Version
SuiteScript 2.x, documented for 2.1; since NetSuite 2018.1
call shapefrom Oracle's parameter table
1query.create({2    type:      /* string, required */,3    columns:   /* Object[], optional */,4    condition: /* Object, optional */,5    sort:      /* Object[], optional */6});
Oracle reference for this method
ParameterTypeRequiredDescription
options.typestringrequiredThe 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.columnsObject[]optionalAn 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.conditionObjectoptionalA 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.sortObject[]optionalAn 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 .
B

Supported syntax · compiles today

myntquery T where ...
1let customers = query Customer2    where email !== ""
suitescriptoutput, trimmed
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.

C

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.

All discussions
Mynt todaylet customers = query Customer

Loading proposals from GitHub…

D

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, save and Ref[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?

N/query · query.create(options)

Suggest syntax for create