How to copy attachments from RITM to Incident

kutvaram
Tera Expert

I have used the following script in BR after insert :

GlideSysAttachment.copy("sc_req_item", current.request_item.sys_id, "incident", current.sys_id);

But it is not working.

Please do the needful.

Regards,
Ram Prakash

1 ACCEPTED SOLUTION

Thank you. That indicates that the incident is using the parent field to point to the RITM record. In that case, your business rule should be able to copy the attachment from the RITM to the incident record using the copy command I gave earlier if everything else is working properly.



GlideSysAttachment.copy("sc_req_item", current.parent, "incident", current.sys_id);



If not, please use the business rule debugger to ensure your business rule is triggering, or debug statements in your UI action (if that is how you are copying the file.) You may also find this video helpful for debugging:



Faster Server Side Script Development and Test


View solution in original post

16 REPLIES 16

Hello Chuck,



Here is the screenshot :



Incident in RITM.jpg


Regards,


Ram


Thank you Ram.



When you said related list, I was expecting the list that appears at the bottom and displays in a slightly different format, not an embedded list. Not to worry.



Go to the form menu and select Configure> Form Layout



find_real_file.png



Next, take a screen shot of the form layout screen similar to that below and include it here. Thank you.



find_real_file.png


Hello Chuck,



Below is the requested screenshot :



Form Layout.jpg


Regards,


Ram


Thank you. That indicates that the incident is using the parent field to point to the RITM record. In that case, your business rule should be able to copy the attachment from the RITM to the incident record using the copy command I gave earlier if everything else is working properly.



GlideSysAttachment.copy("sc_req_item", current.parent, "incident", current.sys_id);



If not, please use the business rule debugger to ensure your business rule is triggering, or debug statements in your UI action (if that is how you are copying the file.) You may also find this video helpful for debugging:



Faster Server Side Script Development and Test


Hello Chuck,



It is working now as per the above mentioned script.



Thanks for the help.



Regards,


Ram