Copy Attachment with out duplicates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2014 06:45 AM
Hi All,
I am trying to copy attachment from task table to request with out duplicates
can any one help me
thanks in advance
- Labels:
-
Performance Analytics

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2015 05:23 PM
ROFL!
Nice job, and you used an IIFE! Elegance meter maxed!
I won't comment on the rest though....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2015 08:36 AM
i did something a little different.. in that i did not want duplicate attachments everywhere.... you could actually create one for the sc_task table and add one more layer of .parent to show the attachments on the request on all the tasks.
so... i created a global relationship to show attachments on an items parent...
NAME: Parent --> Attachment
applies to table Global
Queries from Table Attachment
query with:
current.addQuery('table_name',parent.parent.sys_class_name);
current.addQuery('table_sys_id',parent.parent.sys_id);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2016 07:10 AM
Yeah Raymond, the above "Related Attachments" thing I posted on Aug 5th, 2015 shows from child to parent, grandparent... or from parent up AND down, as well as across to see all the siblings and sibling's children. It just takes a little training to look down on the Related Attachment tab instead of up at the top where attachments for only that record is.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2016 02:45 AM
The easiest way to do this is to use the GlideSysAttachment API
If you have a unidirectional sync, you could use
//GSA functions
var gsa = new GlideSysAttachment();
gsa.deleteAll(targetGR);
gsa.copy(current.getTableName(), current.getValue('sys_id'), targetTable, targetID)
I don't know how your tables are built, so you need to figure out yourself, how you will retrieve the target gliderecord, table and id, but aside from that, the above 3 lines, will correctly transfer the attachments, by first cleaning the destination and refilling it with your up-to-date attachments.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2016 07:05 AM
Yes, see above for a design for "Related Attachments" that looks up/down parent-child and across to sibling tasks. You should be able to do a variation whenever there is some kind of relationship where you need to see attachments between the two.