sn-live-debuglisted
Install: claude install-skill theogyeezy/skillz
# ServiceNow Live Debugging — Toolkit & Methodology
## The runner
An MCP script-runner tool (any tool that POSTs a script to the instance) executes server-side JS as the integration service account, bypassing REST ACLs. Session pattern: a `mcp-run-file.mjs` wrapper that spawns the MCP server and posts a script file; write each probe as a `.sn.js` file in the scratchpad, end it with `JSON.stringify(out, null, 2);` as the last expression (that IS the return value). Runner facts: ~45s internal timeout (split long waits into separate calls); `gs.base64Decode` NOT available; `GlideImpersonate` does not take effect; to embed file content in a script, build it in Node with `JSON.stringify(fileText)` — never heredoc-escape by hand.
## Generic probing recipes
- **Schema discovery first, always**: field names via `sys_dictionary` (`name=<table>`, `element!=''`); choice values via `sys_choice` (`name`,`element`, filter `language=en` or values repeat per locale). Never guess field names — `gr.getElements()` is unreliable in this sandbox.
- **Generic record dump**: loop the dictionary field list, `getValue` each, include `getDisplayValue` for references, truncate long values. Dump the WHOLE record when investigating; hand-picked fields hide the answer.
- **Baselines with GlideAggregate** before firing a test (row counts, `groupBy` distributions). A grouped distribution answers "does this EVER work here" in one query.
- **State history**: `sys_audit` (`documentkey`=sys_id, `fieldname`)