- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2020 10:00 AM
Hello All, I am having difficulties removing iCalendar attachments from a Change Request.
I am aware of community post: Removing attachments using GlideSysAttachment
I may be using this wrong in a business rule.
var attach = new GlideSysAttachment();
attach.deleteAll(recordGR);
But further, can I only remove iCalendar attachments?
Solved! Go to Solution.
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2020 08:20 AM
This is the fix for this post:
Thank Sanchin and Sumanth for their guidance.
var gr = new GlideRecord("sys_attachment");
gr.addQuery("table_sys_id", current.sys_id); // sys_id is table_sys_id
gr.addQuery("content_type", 'text/calendar'); // file content type is text/calendar
gr.setLimit(5);
gr.query();
while(gr.next()){
gr.deleteRecord();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2020 10:04 AM
you will have to query sys_attachment table and then delete attachments.
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2020 10:14 AM
Hi Sachin, do you have an example?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2020 10:21 AM
Please see below code
var gr = new GlideRecord("sys_attachment");
gr.addQuery("table_sys_id", current.sys_id); // sys_id is table_sys_id
gr.addQuery("file_name", current.start_at);// update file name as per your instance config
gr.query();
while(gr.next())
gr.deleteRecord();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2020 11:04 AM
Thank you Sachin, works perfectly