- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2022 02:58 PM
Hello SNOW community,
I would like to know the retention period for attachments added to a form or perhaps where to find it. Note: I have created a scoped app with a table extending Task. In case, this affects retention time.
I did some searching but most of it was tied to HR application.
Thank you!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2022 06:01 AM
Hi
As I had mentioned above, there isn't a retention period for attachments as far as when they will be purged. Using your scenario, that incident would still be there 5 years later with the attachment 🙂
If you delete the incident, the attachment is also deleted, just throwing that out there.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2022 03:08 PM
Hello,
Attachments are stored in sys_attachment table and metadata in sys_attachment_doc
Please refer:
Hope this helps.
Thanks,
Raj

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2022 03:09 PM
AFAIK, attachments should be retained without a set period.
There are 2 Scheduled Jobs to clean attachments:
-
Cleanup Attachment Scan History - clean attachments that has been marked to be infected with virus
- Remove Orphaned Attachments - remove attachments without form
Scheduled Jobs can be accessed from "System Definition" > "Scheduled Jobs"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2022 03:25 PM
Attachments can be deleted after a certain amount of time by creating a Scheduled Job.
Haven't tested but something like below in the scheduled job script.
var tableName = 'incident';
var grInc = new GlideRecord(tableName);
grInc.addEncodedQuery("sys_created_on<javascript:gs.beginningOfLastYear()");
grInc.query();
while(grInc .next()) {
var attachment = new GlideSysAttachment();
var agr = attachment.getAttachments(tableName, grInc.sys_id);
while (agr.next()) {
gs.info(agr.sys_id + " filename:" + agr.getValue('file_name'));
attachment.deleteAttachment(agr.sys_id);
}
}