Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Append data to an attachment without reloading it's large size content

A Elbarbary
Giga Guru

Hi community,

 

There is a situation where I need to process large chunks of data (coming from a web service) and write it to an attachment. The problem with GlideSysAttachment.write or GlideSysAttachment.writeContent is that it requires all the content at once and I believe that it will be too large to fit in memory (I don't have clues yet how large the data would be but I know it will be very).


Due to this, I wanted to know if it's possible to dump first page then programmatically append next pages to the existing attachment. I tried to add base64 data to to table sys_attachment_doc  but that didn't work, also I searched the documentation and the only file stream class GlideScriptableInputStream/GlideTextReader provides only reading capabilities.

 

Thanks in advance.

 

1 REPLY 1

Tushar
Kilo Sage
Kilo Sage

Hi there,

 

One of my friend had the same use case and I remember them implementing an external cloud storage service rather than storing it directly in ServiceNow.

 

Thanks,

Tushar