Deleting multiple attachments the faster way
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2017 11:56 AM
I have accidentally pasted multiple images into the KB article and wanted to delete all those attached images. However, it is tedious since I have to select each tick box, then click Remove. Is it possible to add a select all or remove all button?
- Labels:
-
Knowledge Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2017 12:00 PM
Hello Charlespalma,
You can execute the below script from Background-scripts to delete the attachments.
deleteAttach();
function deleteAttach()
{
var gr = new GlideRecord('sys_attachment');
gr.addQuery('table_name', 'PASS TABLE NAME HERE');
gr.orderBy('table_sys_id', 'PASS RECORD SYS_ID HERE');
gr.query();
while(gr.next())
{
gr.deleteMultiple();
}
}
NOTE: Untested code.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2017 01:36 PM
Or you can try deleting them en mass from the attachment list -- https://[instance].service-now.com/nav_to.do?uri=/sys_attachment_list.do