Code Search Configuration
Control GraphQL Code Search scope, review tables and field overrides, and resolve parent records.
Last updated: November 2, 2026
Configure the tables and fields searched by GraphQL Code Search, available with Pro. For starting a search, syntax, and results navigation, see Code Search.
How It Works
- Uses the ServiceNow GraphQL API for parallel queries across hundreds of tables in batched requests.
- A curated field index of ~450 code-related tables is pre-loaded, covering script, condition, HTML, XML, JSON, and CSS fields.
- Your selected Code Search Group (including custom tables like
u_*/x_*) is layered on top automatically, using the admin-configuredsearch_fieldsandadditional_filterfromsn_codesearch_table. Fields configured on the group are added to the curated ones for that table, and are not truncated by the default 15-field-per-table cap or dropped by short-string heuristics, because the admin explicitly named them. - Results are sorted by relevance: tables with the most matching records appear first.
- Tables that return
insufficient accessorValidationErrorfrom GraphQL are cached as inaccessible and skipped on future searches for 7 days; this is expected for tables the current user can't read or that aren't exposed to GraphQL. You can view and retry them via the Review Tables button. - Failed batches are automatically split and retried with smaller payloads, so a single problematic table won't break your entire search.
- Tables are queried in parallel batches (50 at a time) so first results appear while later batches are still in flight.
- The field index is cached locally for 30 days. Use Refresh to rebuild it.
Scope Precedence
When GraphQL mode decides which fields to search in a given table, the following precedence applies (highest wins):
- Local override: fields you configured in the Review Tables editor on this device. Used exactly as you set them: a field you unticked stays out.
- Group + Curated: the
search_fieldsconfigured on thesn_codesearch_tablerow for the selected Code Search Group, combined with the default fields SN Utils curates for that table incodesearch.json. - Curated: for tables that are not in your group, the default fields from SN Utils's
codesearch.jsoncurated list. - Discovered: fields discovered via
sys_dictionarywhen Extended search is enabled (subject to length and type heuristics).
Group and curated fields are combined rather than one replacing the other, because Code Search Group rows are usually written once for Classic mode and rarely revisited. If your group defines search_fields=name,script on sys_ui_action, GraphQL searches those two fields plus the curated condition and client_script_v2, so a narrow group row never shrinks what GraphQL looks at. Any additional_filter (for example active=true) on the same row is prepended to every GraphQL query for that table.
A local override is different: it is your explicit choice, so it is used verbatim and nothing is added to it. If the admin later adds a field to the group row for a table you have overridden, the Review Tables panel flags it on that override with Add them / Keep mine, so the override cannot quietly fall behind the group.
Review Tables
Click Review Tables in the field index bar (or the Scope: chip next to the field-index status) to inspect and customize the current search scope:
- See which tables were searched, their fields, and the generated GraphQL queries. Each row shows a source badge (
Curated,Group,Override, orDiscovered), so you can see why a table is in scope and which configuration won. - View and retry inaccessible tables: tables that returned
insufficient accessor aValidationErrorand are temporarily excluded. Click Retry to forget the cache and re-try them on your next search. - Add custom table: pin any table on your instance (with autocomplete from
sys_db_object), specify the comma-separated fields to search, and an optionaladditional_filterencoded query. Useful for custom tables that are not part of a Code Search Group. - Override fields: for any table already in scope, click Override fields to edit its field list locally. This bypasses the 15-field cap and short-string filter, so every field you list is searched verbatim.
- Reset: remove a local override and fall back to the group / curated defaults for that table.
Local overrides are stored per instance and carried across machines by the existing SN Utils backup/sync flow.
The Scope: chip in the field-index bar summarizes the active group and the number of local overrides, for example Scope: 12 from "My Code Search Group" + 3 overrides.
Graphical Field Picker
Instead of hand-typing a comma-separated field list, the override editor can fetch the columns of any table directly from the instance:
- Type or paste a table name: a Suggest fields button appears next to the input, and the picker also auto-loads when you tab out of the field.
- Under the hood the picker calls
/api/now/ui/meta/{table}(using your current session cookie), so it sees exactly the columns and types you have access to, including extended-table and custom columns. - Each column is shown as a checkbox row with its technical name, label, and a type chip. Columns that are typically worth searching (
string,html,script,script_plain,script_server,script_client,json,xml,css,translated_text,conditions,url,email, and similar) are highlighted as string-like and preselected as the default visible set. A Show all types toggle reveals every other column (reference, integer, glide_date, etc.) if you need them. - Select string-like one-click preset checks every searchable column at once. Clear clears the selection.
- A Filter fields input narrows the grid by name or label. Checked items stay visible even if they don't match the filter, so you never "lose" a selection while browsing.
- The checkbox grid and the comma-separated input are two-way bound: typing into the CSV updates the checkboxes, and checking a box updates the CSV. Manual entries that don't appear in
ui/meta(for example, a legacy renamed column) are preserved at the front of the CSV. - Results are cached in memory for the session, so reopening the picker for the same table is instant.
Parent Record Resolution
Some tables store scripts that "live inside" a parent artifact: sys_variable_value, for example, holds Flow Designer action input values, catalog-variable defaults, and record-producer values. A bare sys_variable_value match doesn't tell you which artifact the script belongs to, only that some variable somewhere has matching content.
Each sys_variable_value hit gets a small Used by chip showing the immediate parent table name (from the document column) and the parent's short sys_id. The magic-wand button on the chip walks the parent chain on click: for a Flow Designer match this means stepping sys_hub_action_input → sys_hub_step_instance → sys_hub_action_type_base so the chip lands on the action you actually think of, not the intermediate plumbing record. The full hop trail (each table, the field that connected it to the next, and any error on a broken hop) lives in the link's tooltip, so you can see exactly how the script is wired into the artifact.
The chain is driven by two layers:
- Curated mapping. Common Flow Designer hops ship in
js/codesearch.jsonunder_parentChains(action input → step instance → action type, trigger instance → flow, subflow input/output → flow, etc.). These are walked first. - Dynamic discovery. When the chip hits a table that isn't in the curated map, the walker queries
sys_dictionaryfor the table's reference columns, picks the most "parent-like" one (flow,action,step,parent,instance, …), and caches the result per-instance in IndexedDB. The next click on a chip pointing at the same intermediate table is free.
The walker is bounded (max 6 hops) and self-aware (it won't revisit a table it already passed through), so a misconfigured chain can't lock the wand spinning. When the parent record is gone (deleted or no read access) the chip styles itself as inactive and surfaces the reason in the tooltip; the original immediate-parent link stays clickable so you can still navigate to the form view.