# Instructions for Fluent Dashboard API
Always reference the Dashboard API specification for more details. Rules 3-14 and 16 are documented in SDK v4.13.x guides (`dashboard-guide`, `dashboard-filters-guide`); rules 5, 15 and 20 come from the SDK v4.14.0 build plugin and types, and rule 14 was rewritten for SDK v4.14.0 (filter wiring is no longer defaulted at build time).
1. `name` is mandatory. `tabs` and `visibilities` are the most commonly used optional fields; `description` (default empty) and `certified` (default `false`) are also available.
2. Every `tab` in `tabs`, every `widget` in `widgets`, and every item in `visibilities` and `permissions` requires its own `$id` using `Now.ID`. Missing `$id` on any nested object causes a build error.
3. The widget grid is 48 columns wide, not 12 or 24. Author `width` and `position.x` in 48-column units: full width is 48, half is 24, a third is 16, a quarter is 12. `height` and `position.y` are a separate, unscaled axis (not a square grid). Some environments auto-scale width/x by 4x on first install; do not rely on it — always author real 48-column values. Overlapping positions overlap on the rendered dashboard.
4. The `component` string is case-insensitive kebab-case (e.g. `'vertical-bar'`, `'single-score'`, `'pivot-table'`) or a 32-character component sys_id.
5. All data binding happens inline in `componentProps` — there is no separate report or visualization record to create or reference. Do not use a "reportSysId", "reportId", or generic "title" prop. `componentProps` is untyped (not compile-time checked). **SDK v4.14.0+ writes it as given**: the build no longer merges the SDK's widget defaults under it, and install fills in the rest of the component's default keys (dashboard-guide), so a partial object is fine. Set a prop when you need a value other than the component default (e.g. `showZero: true`), and set the filter-following props explicitly (rule 14).
6. Chart, score, and map widgets wire data through three arrays linked by a shared id: `dataSources` (capital S; each with `sourceType`, `tableOrViewName`, `filterQuery`, `id`), `groupBy` (each entry holds a `groupBy` array of `dataSource`, `groupByField`, `isChoice`; `groupByField` is a plain field name for table sources; set `isChoice` to `true` for choice fields), and `metrics` (`dataSource`, `aggregateFunction` such as `'COUNT'`, `axisId`). Category charts take one `groupBy` entry. Time-trend charts (`'line'`, `'column'`, `'spline'`, `'area'`, `'scatter'`, `'step'`) take `metrics` with an `id` plus `trendBy`, whose `trendByFields` entries reference a metric id; without it they render an invalid-configuration message.
7. The title key differs per widget: charts, scores, and `'list'` use `headerTitle`; `'list-simple'` uses `listTitle` (it ignores `headerTitle`); `'calendar-report'` uses `componentTitle`; `'heading'` uses `label` (with `variant` and `level`).
8. `'single-score'`, `'dial'`, and `'gauge'` take `metrics` only — no `groupBy`. Always set `showZero` to `true` on `'single-score'` (the component's default is `false`; the build writes `componentProps` verbatim and applies no default), or a genuine zero COUNT renders "No score". `'dial'`/`'gauge'` set their range with `minValue`/`maxValue`.
9. `'pivot-table'` needs all four, or its value cells render blank even though it deploys: `newReporting` set to `true` with `dataCategory` set to `'group'` (the component's default for `newReporting` is `false`); two separate `groupBy` entries with `categoryIndex` 0 (rows) and 1 (columns); `metrics` entries with an `id` plus `numberFormat`; and `showFirstGroupAggregate`, `showSecondGroupAggregate`, `showTotalAggregate` set to `true`. `'heatmap'` instead puts both dimensions in one `groupBy` entry; `'bubble'` and `'boxplot'` use two entries without `categoryIndex`.
10. `'list'` is aggregation-capable (wired like charts, plus `table`, `columns`, `groupByField`, `show*` toggles, `wrapCellContent`). `'list-simple'` is a flat filtered table (`table`, `query`, `fixedQuery`, `columns`, `maxColumns`, inverted `hide*` toggles, `wordWrap`) with no `dataSources` or `metrics`. Never copy props between the two. For both, `columns` is one comma-separated string of field names, not an array, and there is no sort prop: sort in the query with `^ORDERBYDESC<field>` (or `^ORDERBY<field>`), never a bare `^ORDERBY`.
11. `'calendar-report'` is not wired like charts: set `componentTitle`, `table`, `startDateField` (internal field name, e.g. `opened_at`), and `eventDisplayFields` (comma-separated string). `endDateField` plots spans and is required unless `hideEndDate` is `true`.
12. `'geomap'` groups by a location field (`isChoice` `false`); `mapSysId` takes a `sys_report_map` sys_id (World is the default). `'indicator-scorecard'` is driven by Platform Analytics indicators, not `dataSources`. Do not use the name itself: the SDK build plugin maps it to a malformed 33-character id, so set `component: '9d31ba4d773ce32ef350d4555b673f6e'` (the "Indicator scorecard" macroponent sys_id). Then choose `scorecardType` `'list'` or `'pivot'`, and `sourceType` `'1'` (explicit `indicators` with `pa_indicators` sys_ids), `'0'` (a query), or `'2'` (an indicator group); breakdowns reference `pa_breakdowns` sys_ids. Resolve these sys_ids with the query_fluent_records tool — a sys_id that does not resolve deploys without error and renders an empty widget. `'image'` takes `src` as a leading slash plus a `db_image` record name.
13. Filters: a `'filter'` widget takes `datasource` (singular, lowercase — where the selectable options come from; not `dataSources`) and `targets` (an array of places the selection is applied). Each payload is a choice field (`table`, `field`, `fieldType` `'choice'`), a reference (datasource is the referenced table, e.g. `sys_user`; the target names the reference field with `primaryKey`), a date (`filterComponentType` `'date'` with an empty datasource), or a Platform Analytics breakdown (type `'indicator'`). A `'filter-group'` puts its child filters in `groupConfiguration.filters`; top-level `targets` alone render "No filters configured".
14. Filter scope follows placement: a filter in `topLayout.widgets` renders above the tab bar and drives following widgets on every tab (the conventional home for primary filters); a filter inside a tab drives only that tab. The link is the target's table and field, so a filter targeting the `priority` field of `incident` narrows every incident-sourced widget in scope. Set `followFilters: true` and `filterConfigurations: '@state.parFilters'` in the `componentProps` of every widget that must follow filters. Data widgets carry them by default after install (dashboard-filters-guide), but the guide still says to set `followFilters: true` explicitly, and since SDK v4.14.0 the build no longer writes them for you.
15. `'filter-group'` resolves to its component sys_id as of SDK v4.14.0. Not verified: `filter` and `list-simple` are still absent from the SDK build plugin's component name-to-sys_id map, so the build writes them through as literal strings — verify on an instance, or pass the component sys_id instead.
16. Size by content: `'heading'` full width and short (48 by 3), `'single-score'` about 7 high, `'geomap'` 16+ wide and 18 high. For `'vertical-bar'` with 6-8 categories keep the width-to-height ratio at or below 1.5 (12-24 columns); reserve full width for long time series and wide lists.
17. To link a dashboard to a Workspace, add a `visibilities` entry referencing the exported `Workspace` object: `{ $id: Now.ID['vis_id'], experience: myWorkspace }`. `experience` also accepts a `sys_ux_page_registry` sys_id string.
18. `permissions` entries are mutually exclusive on the subject: provide exactly one of `user`, `group`, or `role` per permission object. Mixing multiple subjects in one entry causes a build error.
19. Import from `@servicenow/sdk/core`: `import { Dashboard } from '@servicenow/sdk/core'`.
20. Give each widget an accessible `name` (SDK v4.14.0+, optional, default empty): it is read by screen readers and shown in some component headers.
