Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

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

A Elbarbary
Tera 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

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