How to export attachment file from table to MID server for back up?

Aki18
Tera Contributor

I would like to export attachment file (MS Word, PPT, Excel, etc.) from a table to somewhere in MID server for back up.

I understand that "Export Set" can be used to easily export records data from ServiceNow to MID server.

However, it doesn't seem to be able to export attachment using that... Is there any good way to easily export attachment file on table to MID server?

3 REPLIES 3

Sandeep Rajput
Tera Patron
Tera Patron

Attachments are stored inside sys_attachment and sys_attachment_doc tables. sys_attachment stores the meta data e.g. file name, table name, table sys_id etc. where as the sys_attachment_doc table stores attachment in form of binay data. 

 

You can export the data from both these tables and recreate the attachment on MID server by sequencing the data packets from sys_attachment_doc table according to their position (it is a field on sys_attachment_doc).

Hi Sandeep,

 Can you share any code after exporting data how where you able to recreate attachment on the mid server using sys_attachment_doc table.

Thanks

Gautam

rutuja6
Tera Contributor

Hi Aki18,

I got similar requirement. Could you please help me with the solution if you were able to achieve this?

 

Thanks,

Rutuja