Skip to content

Commit b002e1a

Browse files
Create Delete attachments older than 720 days.js
1 parent eb2acd8 commit b002e1a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var attachment = new GlideRecord('sys_attachment');
2+
attachment.addQuery('sys_created_on', '<=', gs.daysAgo(720));
3+
attachment.query();
4+
var count = 0;
5+
while (attachment.next()) {
6+
attachment.deleteRecord();
7+
count++;
8+
}
9+
gs.print('Deleted ' + count + ' attachments older than 720 days.');

0 commit comments

Comments
 (0)