sn_script
Execute custom JavaScript on ServiceNow to interact with GlideRecord and GlideSystem, returning gs.print() output for debugging and automation.
Instructions
Execute a background script on the ServiceNow instance. Runs server-side GlideRecord/GlideSystem JavaScript and returns output from gs.print() calls. Requires admin role. NOTE: This tool requires the optional Playwright dependency.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | JavaScript code to execute (GlideRecord, GlideSystem, gs.print(), etc.) | |
| scope | No | Application scope to run in (default: global) | |
| confirm | No | Required for scripts containing destructive keywords (deleteRecord, deleteMultiple, setWorkflow(false)) | |
| timeout | No | Timeout in seconds (default 30, max 300) |