How to archive/remove older versions of attachments on record without custom tables or Archive Rules
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi,
I am working on an attachment versioning requirement and need some architectural guidance.
Scenario:
We have a custom table named 'Author'. We use a custom "Generate" UI Action to dynamically generate a file and attach it to the record. If a user clicks the UI Action again, it creates a new version of the file and attaches it to the same record.
Requirement:
I need to automatically remove/delete the older versions of the file from the record and retain only the latest version.
Constraints:
We cannot create any new custom tables to store the history or old file bytes.
We cannot create an Archive Rule directly on the sys_attachment table (as ServiceNow natively blocks archiving on system/dependent tables).
Has anyone worked on a similar requirement before? How can I achieve this version control cleanly while staying within these constraints? Any code snippets or structural suggestions (e.g., using specific APIs, attachment table triggers, or out-of-the-box logs) would be greatly appreciated!
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
but what's the business use-case you are solving by maintaining the versions?
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
