Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to download attachment at once from sys_attachment

mohammedhyderal
Kilo Contributor

Hi All,

How to we download all the attachments from SYS_Attachment table?

8 REPLIES 8

Deepak Kumar5
Kilo Sage

I don't think you can. But you can try to retrieve it from doc table.



When you store an attachment to any table, a record is created in the sys_attachment table that contains attachment metadata, and the file data is stored in the sys_attachment_doc table, in 4k chunks. For example, if you attach a 12k file called My_attachment.pdf, then you would have a sys_attachment entry with 3 related sys_attachment_doc entries


Hi Deep,



I have a requirement to download all the attachment at once


Service-Now do not save attachment in a single table. Meta data in sys_attachemnt and actual data in sys_attachment_doc table.


If you click on a attachment in sys_attachement, it pull that data from Doc table.


You can't download from Doc table as the data here store in chunk not fully.



What is you requirement?


Hi Mohammed,



As pointed out earlier, ServiceNow stores attachment in two tables



1) Metadata resides in sys_attachment


2) Content gets splitted in 4K bytes of data into sys_attachment_doc table for single attachment.



If you want to transfer the attachment to other systems, you have to transfer in base64 encoded format. You can try the attachment APIs of ServiceNow



If you want to download all the attachments assocaited with any record, then ServiceNowGuru provided solution will work for you