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.

How to get binary data of attachment?

PhoenixMing0912
Giga Expert

Hi all,

There is a sample coding which is from service now document.

var attachment_sys_id = 'bacd7034dbeaa3403aff6a4948964f28';
attachmentStream = new GlideSysAttachmentInputStream(attachment_sys_id);

However, attachmentStream is just something like "[B@89e840" but I want the real binary data.

I have read through documents but I didn' t find the answer.

Can anyone help me out?

15 REPLIES 15

Hitoshi Ozawa
Giga Sage
Giga Sage

For all those still unable to download attachment, I've uploaded a Scripted REST API source in the following thread. Please also read the reply to the code because I've fixed a bug.

https://community.servicenow.com/community?id=community_question&sys_id=d321fd77dbab5810b1b102d5ca96...