Want to copy the attachments from parent to child case
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2025 01:46 AM
I want to know that if we have 5 attachments in parent case and I need an ability to select and copy only 2 out of 5 attachments into child case. Is It possible?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2025 06:04 AM
Hello @saic2,
Yes, You can write a After BR insert/ update
(function executeRule(current, previous){
var parentRecord = new GlideRecord('parent_table');
parentRecord.addQuery('sys_id', current.parent_id);
parentRecord.query();
if(parentRecord.next()){
var attach = new GlidesysAttachment();
var attachments copied = attach.copy('parent_table',parentRecord.sys_id,current.getTableName(),current.sys_id);
if(attachments copied < 2){
gs.info('copied' + attachments copied + 'attachments from ' + parentRecord.sys_id + 'to' + current.sys_id);
}) (current, previous);
If it is helpful, please hit the thumbs up button and accept the correct the solution by referring to this solution in future it will be helpful to them.
Thanks & Regards,
Abbas Shaik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2025 06:26 AM
Seems you misunderstood the question.
The question says to copy 2 out of 5 files and not all.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2025 06:21 AM
if you use GlideSysAttachment.copy() it will copy all
To copy specific you need custom logic, check below link and enhance, I shared solution 6 years ago
Is there any way to copy single attachment from multiple attachments ??
also check this link
How to copy attachment from one File attachment field to another table
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2025 08:14 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader