- 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-12-2020 08:10 AM
Hi Sumanth, the intent is to delete all ics files from the current Change request. This will be a Business rule. Per Sanchin, this should be the correct:
gr.addQuery("table_sys_id", current.sys_id); // sys_id is table_sys_id
This is my current rule, does not work:
var gr = new GlideRecord("sys_attachment");
gr.addQuery("table_sys_id", current.sys_id); // sys_id is table_sys_id
gr.addQuery("content_type", ics);// update file name as per your instance config
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-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();
}