NetSuite SuiteQL Queries
Overview
SuiteQL is NetSuite's SQL-like query language over its record data —
SELECT statements with WHERE, JOIN, ORDER BY, and similar clauses,
scoped to whatever the connected role can see. It's the right tool when a
question needs custom filtering or joins that no existing report or saved
search already provides.
Anti-triggers
- A question an existing report or saved search already answers — use
reports-and-saved-searches instead of re-deriving something NetSuite
has already computed.
- Retrieving one specific, already-known record — use
records-and-metadata; ns_getRecord is simpler than a SuiteQL query
for a single record by ID.
- Creating, updating, or deleting data — SuiteQL here is read-only.
ns_runCustomSuiteQL is documented by Oracle as accepting read-only
queries only — write statements are not a workaround this skill
supports, or one NetSuite will honor.
- Auth, role permissions, or error handling — use
api-patterns.
Core Concepts
SuiteQL queries NetSuite's underlying record tables (which broadly mirror
record types like customer, transaction, item) using SQL syntax.
It's a subset of SQL, not full ANSI SQL — some familiar constructs may not
be supported. Query results respect the connected role's view permissions
the same way direct record retrieval and reports do.
API Patterns
The confirmed read tool family for this domain:
ns_runCustomSuiteQL — runs a custom SuiteQL query (Oracle's
documentation states explicitly: read-only queries only)
ns_getSuiteQLMetadata — retrieves metadata for records queryable via
SuiteQL, including available fields, data types, and joinable fields;
can be scoped to a specific record type
Both are documented by Oracle at
Available Tools in the MCP Standard Tools SuiteApp.
Common Workflows
Finding a record's internal ID before a direct lookup
ns_runCustomSuiteQL with a targeted SELECT id, ... FROM <type> WHERE ...
- Take the resolved ID to
records-and-metadata's ns_getRecord if a
full record retrieval is needed next
Building a query against an unfamiliar record type
ns_getSuiteQLMetadata for the record type in question, to confirm
real field names and available joins
- Write the SuiteQL query against the confirmed fields, rather than
guessing at column names from the NetSuite UI's field labels (which
don't always match the underlying SuiteQL field name)
Answering a cross-record question a report doesn't cover
- Confirm no existing report or saved search already answers it (check
reports-and-saved-searches first — don't re-derive what NetSuite
already computes)
- Write a targeted, bounded SuiteQL query — filter by date range or
specific criteria rather than pulling an entire table
- Report results plainly, noting if the result set was truncated or if
the query should be narrowed further
Gotchas
- SuiteQL is a subset of SQL. Not every construct from full ANSI SQL
is guaranteed to work — if a query fails unexpectedly, simplify it
before assuming the data doesn't exist.
- Bound queries. An unbounded
SELECT * against a large table (e.g.
transaction) is a way to exhaust rate limits and return far more data
than the question needs — prefer explicit columns and a WHERE clause.
- Field names in SuiteQL don't always match NetSuite UI labels. Use
ns_getSuiteQLMetadata rather than guessing from what a field is called
on screen.
- Read-only is enforced by NetSuite here, not just by this plugin's
documentation.
ns_runCustomSuiteQL itself is documented as
read-only-queries-only — but this plugin does not independently verify
that constraint; it is Oracle's own stated behavior. See
GOVERNANCE.md.
Related Skills
1---2name: netsuite-suiteql-queries3description: Running read-only SuiteQL queries against NetSuite data and discovering queryable fields and joins via SuiteQL metadata. The flexible ad-hoc query surface for questions no existing report or saved search already answers.4---56# NetSuite SuiteQL Queries78## Overview910SuiteQL is NetSuite's SQL-like query language over its record data —11`SELECT` statements with `WHERE`, `JOIN`, `ORDER BY`, and similar clauses,12scoped to whatever the connected role can see. It's the right tool when a13question needs custom filtering or joins that no existing report or saved14search already provides.1516## Anti-triggers1718- **A question an existing report or saved search already answers** — use19 `reports-and-saved-searches` instead of re-deriving something NetSuite20 has already computed.21- **Retrieving one specific, already-known record** — use22 `records-and-metadata`; `ns_getRecord` is simpler than a SuiteQL query23 for a single record by ID.24- **Creating, updating, or deleting data** — SuiteQL here is read-only.25 `ns_runCustomSuiteQL` is documented by Oracle as accepting **read-only26 queries only** — write statements are not a workaround this skill27 supports, or one NetSuite will honor.28- **Auth, role permissions, or error handling** — use `api-patterns`.2930## Core Concepts3132SuiteQL queries NetSuite's underlying record tables (which broadly mirror33record types like `customer`, `transaction`, `item`) using SQL syntax.34It's a subset of SQL, not full ANSI SQL — some familiar constructs may not35be supported. Query results respect the connected role's view permissions36the same way direct record retrieval and reports do.3738## API Patterns3940The confirmed read tool family for this domain:4142- `ns_runCustomSuiteQL` — runs a custom SuiteQL query (Oracle's43 documentation states explicitly: read-only queries only)44- `ns_getSuiteQLMetadata` — retrieves metadata for records queryable via45 SuiteQL, including available fields, data types, and joinable fields;46 can be scoped to a specific record type4748Both are documented by Oracle at49[Available Tools in the MCP Standard Tools SuiteApp](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/article_0902023508.html).5051## Common Workflows5253### Finding a record's internal ID before a direct lookup54551. `ns_runCustomSuiteQL` with a targeted `SELECT id, ... FROM <type> WHERE ...`562. Take the resolved ID to `records-and-metadata`'s `ns_getRecord` if a57 full record retrieval is needed next5859### Building a query against an unfamiliar record type60611. `ns_getSuiteQLMetadata` for the record type in question, to confirm62 real field names and available joins632. Write the SuiteQL query against the confirmed fields, rather than64 guessing at column names from the NetSuite UI's field labels (which65 don't always match the underlying SuiteQL field name)6667### Answering a cross-record question a report doesn't cover68691. Confirm no existing report or saved search already answers it (check70 `reports-and-saved-searches` first — don't re-derive what NetSuite71 already computes)722. Write a targeted, bounded SuiteQL query — filter by date range or73 specific criteria rather than pulling an entire table743. Report results plainly, noting if the result set was truncated or if75 the query should be narrowed further7677## Gotchas7879- **SuiteQL is a subset of SQL.** Not every construct from full ANSI SQL80 is guaranteed to work — if a query fails unexpectedly, simplify it81 before assuming the data doesn't exist.82- **Bound queries.** An unbounded `SELECT *` against a large table (e.g.83 `transaction`) is a way to exhaust rate limits and return far more data84 than the question needs — prefer explicit columns and a `WHERE` clause.85- **Field names in SuiteQL don't always match NetSuite UI labels.** Use86 `ns_getSuiteQLMetadata` rather than guessing from what a field is called87 on screen.88- **Read-only is enforced by NetSuite here, not just by this plugin's89 documentation.** `ns_runCustomSuiteQL` itself is documented as90 read-only-queries-only — but this plugin does not independently verify91 that constraint; it is Oracle's own stated behavior. See92 [GOVERNANCE.md](../../GOVERNANCE.md).9394## Related Skills9596- [Records & Metadata](../records-and-metadata/SKILL.md) — Direct record retrieval by ID97- [Reports & Saved Searches](../reports-and-saved-searches/SKILL.md) — Pre-built views to check before writing a custom query98- [API Patterns](../api-patterns/SKILL.md) — Auth, roles, and error handling