How to get binary data of attachment?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2018 07:27 PM
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?
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2020 08:15 AM
Hi PhoenixMing0912,
Did you ever get it to work correctly?
I also need to sent an attachment via a multipart form.
Kind regards,
Matthijs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2020 05:51 PM
As far as I remember, finally I use Base64 format instead of binary.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2020 07:15 PM
You can send binary attachments from ServiceNow to other platforms with multipart, however it is pretty complicated. This article explains it:
https://servicenowthink.wordpress.com/2020/04/13/how-to-send-binary-data-with-multipart-from-servicenow-to-third-party-applications-for-free/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2020 02:00 AM
I ended up using the following:
This worked for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2020 07:15 PM
There is no direct way to get binary data in service, you can only get binary representation in a string.