Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

JSON object in Scoped Application

hmartind
Kilo Expert

Hello,

Working on a Helsinki instance,

var json = new JSON();

Works fine in the Global Scope but crashes within an Scoped Application:

Invalid object in scoped script: org.mozilla.javascript.gen.sys_script_include_04cf1a2f0fd2020094f3c09ce1050eba_905@1cadf34

{"error":{"detail":"TypeError: org.mozilla.javascript.NativeJSON@7737e3 is not a function. (sys_script_include.1d264e71dbd83200b7bbd001cf961986; line 7)","message":"org.mozilla.javascript.NativeJSON@7737e3 is not a function."},"status":"failure"}

Any idea how to solve this issue?

Many thanks.

5 REPLIES 5

Bharath40
Giga Guru

Hector see if this info is helpful.



In scoped application , you may need to use decode method inplace of parse


Re: How to use JSON in workflow script?



Alternatively you could change scope of JSONParser script include to use parse method


Re: How to call REST Message via Scheduled Job in scoped application?