
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2020 07:00 AM
Can anyone please help me with the attachment sync,
I have written a BR for attachments to move from child to parent, which is attaching all of those if a new attachment is done on the child case.
I need only the latest once.
table: sys_attachment
after, insert and update
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord(current.table_name);
gr.get(current.table_sys_id);
if(gr.parent){
GlideSysAttachment.copy(current.table_name, current.table_sys_id, gr.parent.getTableName(), gr.parent);
}
})(current, previous);
Please help in syncing the attachments from parent to child hr cases.
Solved! Go to Solution.
- Labels:
-
HR Service Delivery

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2020 05:58 AM
Hi Palak,
Kindly refer to this link which allows you to copy 1 attachment from 1 record to another.
Kindly mark the comment as a correct answer and helpful if it helps to solve your problem.
Regards,
Asif
2020 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2020 07:30 AM
Hi,
please refer below link:
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2020 11:42 PM
Hi Ankur,
I am using the GlideSysAttachment.copy, but it copies all the attachments again n again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2020 12:18 AM
Hi,
just check the script above and it should help you
You can also refer below link:
https://community.servicenow.com/community?id=community_article&sys_id=633352e5db327b402be0a851ca961932
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2020 07:32 AM
The copyattachment function copies everything. so 2 options as far as I can see
- delete all the attachment on the child before invoking the function (risky as it would delete attachment made on the child directly)
- delete duplicates -> see documentation: Useful attachment scripts
Good luck!