Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

File attachment in bytearray

Luca Armienti1
Tera Expert

Hi,

 

Is there a way to convert a file attachment in a bytearray stream? not base64, an Array of bytes.

 

It's needed for an integration: the web service is asking for a file in byte array format.

 

I tried two things:

 

1) Packages.java.io.ByteArrayOutputStream();
2) GlideSysAttachment.getContentStream(), and then using GlideTextReader as suggested, but i don't understand what GlideTextReader methods do, it's not well explained.
 
The first option give me a small string like "[B@143e765" instead of a byte stream. The second one i can't even make it work.
 
Thanks,
Luca
 
0 REPLIES 0