created 3m ago in Developer Community
 

I used below code to copy attachments from RITM to approver table to make attachment visible in 'Ticket Attachment' widget in portal.

(function executeRule(current, previous /*null when async*/) 
{
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id',current.sysapproval);
gr.query();
gr.getRowCount();
while(gr.next()) {
GlideSysAttachment.copy("sc_req_item",gr.sys_id,'sysapproval_approver', current.sys_id);
}
})(current, previous);

I checked by placing logs. I could find that there is no sys id. Also to test, I directly attached in approver's table. That is was working fine.