- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2020 10:49 AM
Hello Experts,
We have special use case where we have Parent & child case stored in same HR table.
I need to copy attachment from child case (hr performance case table) to parent case (on HR performance case table).
I see multiple community posts where copy from one table to another. But I couldn't find help on copying attachment from one record to another on same table.
Solved! Go to Solution.
- Labels:
-
Instance Configuration

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2020 01:56 AM
Hi
You have to apply the logic such a way that this BR should run only once so it will copy once.
Question, When do you want to copy attachment ? which event ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2020 12:26 PM
Hi Vikrami,
Below example script(replace with your table and applicable sys_ids) will work on same table record too.
GlideSysAttachment.copy('sn_hr_core_case_operations','sys_id','sn_hr_core_case_operations','sys_id');
Please mark answer correct, if it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2020 08:40 PM
Also, shall I use this script as BR?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2020 08:57 PM
Yes,
Use this in after BR. example considering sn_hr_core_case_operations is table and parent column is column of parent.
GlideSysAttachment.copy('sn_hr_core_case_operations',current.sys_id.toString(),'sn_hr_core_case_operations',current.parent.sys_id.toString());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2020 08:58 PM
Parent HR details are stored in parent field so you can use this
To copy from child to parent
GlideSysAttachment.copy('performance table', current.sys_id, 'performance table', current.parent);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader