Query Delete Records
query_delete_recordsDelete ServiceNow records matching an encoded query. Use dry-run mode to preview the count before permanent deletion.
Instructions
Find records matching an encoded query and delete them all. Supports a dry-run mode: set confirm=false (the default) to see how many records would be deleted WITHOUT making changes, then set confirm=true to execute.
IMPORTANT: When confirm=true, this PERMANENTLY DELETES records on the ServiceNow instance. Always run a dry-run first to verify the match count before committing. This operation cannot be undone.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| instance | No | The ServiceNow instance auth alias (e.g., "myinstance", "prod"). If not provided, falls back to the SN_AUTH_ALIAS environment variable. | |
| table | Yes | The ServiceNow table to delete records from (e.g., "incident", "sys_user"). | |
| query | Yes | An encoded query string to find records to delete. Examples: "active=false^sys_created_on<javascript:gs.daysAgoStart(365)". | |
| confirm | No | When false (default), performs a dry-run that returns the match count without deleting anything. Set to true to actually execute the deletes. | |
| limit | No | Maximum number of records to delete. If omitted, deletes all matches. |