- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2014 07:07 AM
Is it possible to remove attachments by using GlideSysAttachment? I'm looking for a function similar to GlideSysAttachment.copy(...), something like GlideSysAttachment.remove(...) or GlideSysAttachment.delete(...). If there is such a function where is it documented?
Solved! Go to Solution.
- 27,865 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2014 08:56 AM
If you want to remove all attachments from the record, you can use the following where recordGR is the gliderecord representing the record from which you want to remove attachments.
var attach = new GlideSysAttachment();
attach.deleteAll(recordGR);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2014 07:15 AM
Hi. You should be able to call any JavaScript method on a record if you build the query correctly.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2014 07:54 AM
There is an Script Include named AttachmentAjax that can be called from a Client Script using GlideAjax to perform several attachment related tasks like: list, delete, rename, etc.
GlideSysAttachment can be used to delete attachment as follows:
var attachment = new GlideSysAttachment();
var agr = attachment.getAllAttachments(<table_name>, <table sys id>);
while(agr.next()) {
attachment.deleteAttachment(agr.getValue("sys_id"));
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2014 08:56 AM
If you want to remove all attachments from the record, you can use the following where recordGR is the gliderecord representing the record from which you want to remove attachments.
var attach = new GlideSysAttachment();
attach.deleteAll(recordGR);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-01-2015 12:17 AM
Hi Brad,
We have written an onSubmit client script to show an alert when the attachment character exceeds 100 chars. Suppose there are 2 attachments already attached to the record and I am trying to attach one more attachment to the same record. If this current attachment exceeds 100 chars, i want to remove this from the record. How can I do this?