ServiceNow Cleanup Activity
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago - last edited an hour ago
Hi Community,
While reviewing attachments using sys_attachment.list, I found a large amount of data that appears to be unused and was created before December 2021.
Our ServiceNow instance was implemented around February–March 2022, so these attachments seem to pre‑date the instance onboarding and are not linked to any active business records.
I’m looking for guidance on the best and safest approach to clean up this data.
How I Identified Potentially Unused Attachments
So far, I have used the following checks to identify unused data:
- Filtered sys_attachment records where:
- sys_created_on < 2021-12-01
- Reviewed attachments where:
- table_name is empty or points to tables that no longer exist
- table_sys_id does not have a matching record in the referenced table
- Checked attachments linked to:
- Deleted records
- Inactive custom tables
- Manually verified random samples to confirm they are not referenced anywhere in the UI
I would like to confirm whether this is a correct and complete approach, or if there are additional checks I should perform.
Questions for the Community
- What is the recommended way to confirm attachments are truly unused and safe to delete?
- Are there any out‑of‑box jobs, reports, or scripts to help identify unused attachments?
- Is it a best practice to:
- Delete only from sys_attachment, or
- Also clean up sys_attachment_doc?
- Are there any dependencies, logs, or audit requirements to consider before deleting old attachments?
- What precautions should be taken for production cleanup (backups, approvals, phased deletion, etc.)?
Any best practices, sample scripts, or documentation references would be greatly appreciated.
Thanks in advance!
- Labels:
-
Architect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Check these artcle /post to find how to identify orphaned attachment:
Finding and deleting orphaned attachments
Purge Orphan Attachments (custom solution and... Washington out-of-the-box!)
KB0995336 Attachments for potential deletion
Orphaned ML Model Artifact attachment document records
Now for automated deletion ,you can go for Scheduled scripted execution :
Ref for code: Automatically Delete Attachments \
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi @Tanushree Maiti
Thanks for your suggestions.
