fluent_exec
Run server-side scripts on a ServiceNow instance with a recorded reason and optional rollback, so changes can be traced and undone from Script Execution History.
Instructions
Run a server-side script on the instance through the SDK (now-sdk exec, 4.14+). Unlike a plain background script, the run is recorded on a Script Execution History record with your reason, and record changes can be rolled back from there. REQUIRES FLUENT_ENABLED=true and SCRIPTING_ENABLED=true.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"script": "<script>",
"reason": "<reason>"
},
"name": "fluent_exec"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| auth | No | now-sdk credential alias (optional) | |
| async | No | Run as a background job and return a job_id at once. Poll it with get_job. Calls that take longer than about 20 seconds switch to a job on their own. | |
| scope | No | Scope to run in: app sys_id, scope name or "global" | |
| reason | Yes | Why the script is being run (stored on the execution history record) | |
| script | Yes | Server-side JavaScript to run | |
| directory | No | Fluent project directory, used for the default scope (optional) | |
| server_logs | No | Include the instance session log, with stack traces | |
| record_for_rollback | No | Create a rollback context (default true) |