The CreatorCon Call for Content is officially open! Get started here.

JSON.parse and evalJSON() are not working in scoped application

chandukollapart
Tera Contributor

Hello Everyone,

In scoped application JSON.parse() and evalJSON() are not working in client script(onChange). I am trying to pull user information basing on field "User" in my scoped application table.

var answer = server.responseXML.documentElement.getAttribute("answer");
answer = JSON.parse(answer);

 

var answer = server.responseXML.documentElement.getAttribute("answer");
answer = answer.evalJSON();

I tried both but answer returns null value. Any alternatives?

Thanks

1 REPLY 1

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Chandukollaparthi,

 

While working in Scoped Application ensure to call out of scope includes via API Name. Replace JSON.parse(answer); with new global.JSON.parse(answer);

 

Thanks,

Pradeep Sharma