Any workaround for GlideSysAttachment() in scoped application?

mukesh09
Kilo Explorer

Hi All,

It seems 'GlideSysAttachment()' is not supported in the scoped application. So is there any workaround for this exist? I am on Fuji release patch 6.

Regards,

4 REPLIES 4

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Mukesh,



You may find the below thread helpful.


https://community.servicenow.com/thread/178721


Thanks for your reply but this doesn't solve my issue (thread only talks about the copying of attachment it seems). Basically I need to use 'GlideSysAttachment' in one of my web services call to send attachment like this:



var sysAttachment = new GlideRecord('sys_attachment')




// some code goes here




var attachPackage = GlideSysAttachment();     // This doesn't work in scoped application hence need replacement of the same


var bytes = attachPackage.getBytes(sysAttachment);



// some code goes here


asit_vachhani
Giga Contributor

I am having the same problem with my scoped application. Mukesh please post solution if you have already found one. I am using below code.



var attach = new GlideSysAttachment();


var id = attach.write(mapSet, fileName, 'application/json', body);


I haven't found any solution of this as of now. I strongly feel that 'ServiceNow' should remove restrictions from the APIs for scope applications, as its really painful to work with scope application with such restrictions !!