How to clean up old or unwanted records fast from a table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2025 12:07 AM
Purpose:
The guide explains how to automatically and efficiently delete old or unwanted data from a table in ServiceNow using a feature called Auto Flush (Table Cleaner).
How It Works:
Auto Flush deletes records in batches, so it doesn’t slow down the system.
It’s great for regularly or one-time cleaning of outdated data.
Steps to Set It Up:
Go to: All > sys_auto_flush_list.DO (Auto Flushes table).
Click "New" to create a new Auto Flush rule.
Fill these fields:
Table Name: Table you want to clean (e.g., sys_user)
Match field: Field used to decide which records to delete (e.g., sys_created_on)
Age in Seconds: How old the record should be to get deleted
e.g., 30 days = 2,592,000 seconds
Use 0 to delete all records matching conditions
Conditions: Add filters (optional) to narrow down which records to delete
Cascade Delete: Also delete related/child records if needed
Active: Turn the cleanup rule on or off
Clean Attachments & Journals: Option to delete attached files and journal logs
Clean Audit: Option to delete audit logs from sys_audit and sys_audit_relation
Example:
To delete users who haven’t logged in for 90 days, set:
Table: sys_user
Match field: e.g., last_login
Age in seconds: 7,776,000 (90 days)
Important Note:
If it’s a one-time cleanup, delete the Auto Flush rule after it runs, to prevent it from running again in the future.
- 586 Views