How to copy attachment from sys_attachment table to a field

Sarika S Nair1
Kilo Sage

How to copy attachment from sys_attachment table to a field of file attachment type in a custom table.

1 ACCEPTED SOLUTION

Hi,

then the same script can be used to update the attachment field

var att = new GlideRecord('sys_attachment');

att.addQuery('table_sys_id', current.sys_id);

att.query();

if(att.next()){

current.attachment_fieldName = att.sys_id;
current.setWorkflow(false);
current.update();

}

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

20 REPLIES 20

Hii,

But It is worked on my instance(Paris).

Regards.

vikas