Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Copying Attachments from Parent to Child

htank66
Kilo Contributor

Hello all,

I have a question on how to get all of the parent attachments onto the child automatically.  I currently have made a Business rule on the Parent table.

find_real_file.png

 

find_real_file.png

 

I feel like there is something obvious that I am missing.  Any help is appreciated.  Thanks in advance!

17 REPLIES 17

Tyler Hoge - Gl
Tera Guru
GlideSysAttachment.copy('sourcetable','sys_id','destinationtable','sys_id');


this is an easy script to copy attachment from one record to another.


you should do this from the child table and not the parent.
pull in the parent sys_id using the parent field on the child task.



GlideSysAttachment.copy('change_tack',current.sys_id,'change_request',parent.sys_id);

find_real_file.png

 

Okay I have updated it to what you have suggested.  The table has also been updated to the child task.  Should i be putting in the table sys_ids in the portion they are referred to? It doesn't seem to be working.

it looks the the parent field isnt on the change_task table. It is actually change_request.

 

the script should be 

GlideSysAttachment.copy('change_tack',current.sys_id,'change_request', current.change_request);

Still no luck unfortunately... any other ideas?