Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Cleanup Unlinked Attachments

Overview

This script automatically deletes attachments that are no longer linked to any record in ServiceNow.

Attachments that are not associated with a table or record can consume unnecessary storage and affect instance performance.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var att = new GlideRecord('sys_attachment');
att.addNullQuery('table_sys_id');
att.query();
while (att.next()) {
gs.info('Deleting Unlinked attachment: ' + att.sys_id);
att.deleteRecord();
}
Loading