On this page
draftReport
query · in the family Reading your records
What it does
Describe the report you want in plain words and get a report definition back — which records, and what to say about them (the columns to list, or the groups and totals) — shown in words before anything runs.
Draft ONE report definition from plain words: the assistant routes your words onto the plan grammar AND the report shape in ONE strict structured call — the start family, up to 3 hops along KNOWN relationships, each step's conditions, plus what to list (columns) or how to group and total (groupBy + measures) IN WORDS; each step's conditions pass through the SAME interpreter the filter builder uses (names resolve inside your tenant; every clause re-validated exactly as hand-built); the plan passes THE PLAN GATE; then ONE more strict call resolves the worded columns, keys and measures against the LAST family's own roster (a closed list of its reportable field names — nothing outside it can be emitted); the assembled spec passes THE REPORT GATE before you see it (a refused plan re-asks the route ONCE, a refused shape re-asks the resolve ONCE — each with the gate's own words — then VALIDATION/INVALID in the teaching voice). words is one written ask, 1..500 characters. Metered office.report_draft (the route + the resolve) and office.filter_interpret per step. Refuses INTEGRATION/UNAVAILABLE while the planner is offline/keyless — build the report by hand. Requires authentication (user sessions only — the interpretFilter class).
What happens
A drafting assist: nothing runs and nothing is saved. The assistant routes your words onto the plan grammar and the report shape, interprets each step’s conditions (names resolve inside your organization), then resolves the columns, group keys and measures against the last step’s own field list; the definition passes the same gate a hand-built report passes; you run it with reportRun or save it with createReport. Every call is metered like any other AI call.
Who may call it
Capability area: Reading your records — Looking up and listing the records of your organization.
- Owner
- System Administrator
- Manager
- Associate Manager
- Warehouse Associate
- Sales Associate
- An API key whose scope allows
api:draftReport
Arguments
| Name | Type | Required | Notes |
|---|---|---|---|
words | String String! | yes | No further notes. |
Returns
ReportDraft ReportDraft! — NOTHING has run and nothing is saved.
Example request
query ExampleDraftReport($words: String!) {
draftReport(words: $words) {
words
specJson
reasoning
}
}
Variables:
{
"words": "<words>"
}
Example response
{
"data": {
"draftReport": {
"words": "<words>",
"specJson": "<spec json>",
"reasoning": "<reasoning>"
}
},
"extensions": {
"at": {
"callId": "01EXAMPLE-CALL-ID",
"version": {
"requested": null,
"serviced": {
"name": "genesis",
"number": 0
}
}
}
}
}
Errors this call can answer
VALIDATION/INVALID— Something in the request is not valid. (VALIDATION)AUTHN/REQUIRED— Sign in to do this. (AUTHN)AUTHZ/FORBIDDEN— Your role does not allow this action. (AUTHZ)RATE_LIMIT/THROTTLED— Too many requests in a short time. (RATE_LIMIT)