- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2015 04:00 AM
Is workaround found for GlideSysAttachment() in scoped application?
I see the below 2 threads have not got solutions yet.
How to use/replace GlideSysAttachment for scoped app?
Any workaround for GlideSysAttachment() in scoped application?
Thanks,
Priya
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2015 07:08 AM
Hi All,
Removing getBytes() from scoped apps was a decision that ServiceNow made because getBytes() can cause an
out-of-memory exception that can bring down an instance, and a scoped app must never be given access to any call that can cause the failure of an instance.
Alternative code for getBytes() and base64Encode will be getContent and getContentBase64 starting from the Fuji Patch 9 version.
var grSysAtt = new GlideRecord('sys_attachment');
grSysAtt.addQuery('table_sys_id', this.incident.sys_id);
grSysAtt.query();
while (grSysAtt.next())
{
var sa = new GlideSysAttachment();
sa.getContent(grSysAtt);
sa.getContentBase64(grSysAtt);
}
Thanks,
Priya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2015 05:22 AM
You may be right. You can call GlideSysAttachment.copy('sourcetable', 'sys_id', 'destinationtable', 'sys_id'); with no issue, so new may not be necessary. I think global.GlideSysAttachment may help. Unfortunately, my scoped app experience is limited at this point.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2015 05:36 AM
Same as mine. Haven't got any exposure on scoped apps so can't comment on that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2015 05:05 AM
Mike Allen is right.It should be new GlideSysAttachment();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2015 06:52 AM
If I am making it to new GlideSysAttachment();
I get the below error,
org.mozilla.javascript.EcmaError: undefined is not a function.
var grSysAtt = new GlideRecord('sys_attachment');
grSysAtt.addQuery('table_sys_id', this.incident.sys_id);
grSysAtt.query();
while (grSysAtt.next())
{
var sa = new GlideSysAttachment();
Error=>var binData = sa.getBytes(grSysAtt);
var encData = GlideStringUtil.base64Encode(binData);
Thanks,
Priya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2015 07:08 AM
Hi All,
Removing getBytes() from scoped apps was a decision that ServiceNow made because getBytes() can cause an
out-of-memory exception that can bring down an instance, and a scoped app must never be given access to any call that can cause the failure of an instance.
Alternative code for getBytes() and base64Encode will be getContent and getContentBase64 starting from the Fuji Patch 9 version.
var grSysAtt = new GlideRecord('sys_attachment');
grSysAtt.addQuery('table_sys_id', this.incident.sys_id);
grSysAtt.query();
while (grSysAtt.next())
{
var sa = new GlideSysAttachment();
sa.getContent(grSysAtt);
sa.getContentBase64(grSysAtt);
}
Thanks,
Priya