Is workaround found for GlideSysAttachment() in scoped application?

Priya Shekar
Giga Guru

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

1 ACCEPTED SOLUTION

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


View solution in original post

11 REPLIES 11

Priya:



Outstanding replacement!   Thank you for documenting this undocumented feature of GlideSysAttachment.   BTW, this also replaces the older Packages.Java.Lang.String call which is used in place of the base64Encode call (in a number of places - even in Istanbul!).



Excellent.   As an MVP I have endorsed your solution and made it known.



Thanks,



Steven.


Thanks Steven.