GlideSysAttachment.copy

sarfraz3
Mega Expert

Can we write GlideSysAttachment.copy in business rule which does not runs on sys_attachment table?.. Or it can be only written on sys_attachment table?.

I have been trying to write it on sc_req_item table.. but it does not copy the attachment!

1 ACCEPTED SOLUTION

Here is an example, copying attachments from one incident record to another.



var sourceSysID = '9c573169c611228700193229fff72400';


var targetSysID = '9d385017c611228701d22104cc95c371';



var copyAtt = new GlideSysAttachment();


copyAtt.copy('incident',sourceSysID, 'incident',targetSysID);



If it was in a a br and I want to copy from lets say to current incident record to the record in the parent incident field it could look like this:



var copyAtt = new GlideSysAttachment();


copyAtt.copy('incident',current.getUniqueValue(), 'incident',current.getValue('parent_incident'));



And make this a async BR for performance.


View solution in original post

15 REPLIES 15

There is an out of the box action ''copy attachment'

 

GoranWitchDoc_0-1669235224503.png