
- 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:38 AM
By the way, it is possible to display attachments from the parent record in its child records (and vice versa) as a related list, in which case there is no need to copy anything and you don't end up with tons of duplicate data.
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2020 11:43 PM
Hi Slava,
I am not using related list as we need to show the attachments in the activity logs, on the SP.

- 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-31-2020 12:03 PM