Is there a way by using Import sets Attachments in an Incident Table

srinivasattili
Kilo Explorer

Hi All,

I have a request where we have bulk data of Incident which needs to be moved to the Instance , However the challenge is they have provided a separate attachment which needs to be attached to all the Incident.

Has any one has any idea about how to add a attachment to list of Incident.

Appreciate you help.

Thanks ,

Srinivas

1 REPLY 1

Mike Allen
Mega Sage

You can use the attachment API in a script.



Or you can do it via script by inserting into ecc queue:


Convert your attachment to base64



var inc = new GlideRecord('incident');


inc.query();


while(inc.next()){



var ecc = new GlideRecord('ecc_queue');


ecc.initialize();


ecc.agent = 'AttachmentCreator';


ecc.topic = 'AttachmentCreator';


ecc.name = 'file_name.xls:application/vnd.ms-excel'   // or whatever the file name is + its content-type


ecc.soruce = 'incident:' + inc.sys_id;


ecc.payload = '<attachment base 64>';


ecc.insert();



}