How do I export and import 1 record in sys_attachment table ?

Bharath kumar6
Tera Expert

I need to export a record from sys_attachment table from prod. And import it in dev(because I need the same sys id).

But using export xml and import xml its not working.

When you click on a record in sys_attachment table , that record will be downloaded.

But here the downloaded file is showing "format is not supported or file is corrupted".

I have already done with "export xml" from one instance and "import xml" in another instance.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

sys_attachment is not the only table where attachment information is present; there is 1 more table for metadata i.e. sys_attachment_doc

you can use Attachment API

Attachment API

Regards
Ankur

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

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

sys_attachment is not the only table where attachment information is present; there is 1 more table for metadata i.e. sys_attachment_doc

you can use Attachment API

Attachment API

Regards
Ankur

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

Thank you Ankur. This piece of information just saved me a great deal of time.

Vinodkp93
Tera Contributor

Hi,

You can export the xml from both table as 'sys_attachment' & 'sys_attachment_doc' for your particular attachment file and then import the same in another instance.

 

Regards,

Vinod Prajapati