execute_script
Execute server-side scripts on ServiceNow to perform complex queries and operations not supported by REST, returning script output.
Instructions
Execute a server-side script on the ServiceNow instance (Background Script). Supports GlideRecord, GlideQuery, GlideAggregate, and all server-side APIs. Returns the script output. Use for complex queries that cannot be expressed via REST. REQUIRES WRITE_ENABLED=true.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scope | No | Application scope to run in (default: global) | |
| script | Yes | Server-side JavaScript to execute. Use gs.print() or gs.info() for output. |