- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2019 10:51 AM
What is the replacement of Packages.java.io.ByteArrayOutputStream() for New York version?
We have custom integration with Third party tool. After the upgrade to NewYork, attachments are not passing over SOAP
It is giving below error::
Error MessageIllegal access to method writeTo(java.io.ByteArrayOutputStream) in class com.glide.ui.SysAttachmentInputStream
var attachmentIS = new GlideSysAttachmentInputStream(attachsys_id);
var bytearrayOS = new Packages.java.io.ByteArrayOutputStream();
attachmentIS.writeTo(bytearrayOS);
var content64 = GlideBase64.encode(bytearrayOS.toByteArray());
Can anyone suggest API/function for the replacement of Packages.java.io.ByteArrayOutputStream().
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2020 07:54 AM
Hi Gursimrun,
It seems ServiceNow changed the signature for the 'writeTo' method.
Try to use "attachmentIS.writeTo(bytearrayOS, 0, 0);" instead of "attachmentIS.writeTo(bytearrayOS);".
Example in the oob script: /sys_script.do?sys_id=468eebfeff447300c2e8a897d53bf16e
I hope this solved your issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2020 09:52 PM
Thanks Florin, this works for me.