- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2015 06:39 AM
Hi,
I have tried using following code in my Scheduled Job (SJ) to call REST Message in a scoped application.
var r = new sn_ws.RESTMessageV2('x_snc_all_time_car.All Surf SN TimeCard', 'get');
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
var parser = new JSONParser();
var parsed = parser.parse(responseBody);
It gives a warning and SJ doesn't get executed at all:
java.lang.SecurityException: JSONParser undefined, maybe missing global qualifier
Then I tried amending with global as below:
var r = new sn_ws.RESTMessageV2('x_snc_all_time_car.All Surf SN TimeCard', 'get');
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
var parser = new global.JSONParser();
var parsed = parser.parse(responseBody);
It gives a warning and SJ doesn't get executed at all:
org.mozilla.javascript.EcmaError: The undefined value has no properties.
Anyone have any idea to handle with this?
Thanks,
Yogesh More
Solved! Go to Solution.
- Labels:
-
Integrations

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2015 06:57 AM
Hi Yogesh,
Please follow the below steps and let me know the outcome.
Go to the script include->Search for JSONParser->Now make sure the field "accessible from" is set to "All application scopes". OOB this is set to be "this application scope only".
Please find the screenshot attached for reference.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2015 09:07 AM
Thanks Yogesh
Glad to know your issue is resolved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2015 11:12 AM
Hello.
I have a similar issue when a script in the workflow for my scoped application calls the JSONParser. Note the same script was working fine when it was in global scope. The error seen in the logs is:
JSONParser undefined, maybe missing global qualifier
I tried adding the following lines at the top of the script, but I still get the error:
gs.include("global.JSON");
gs.include("global.JSONParser");
var parser = new JSONParser();
var parsed = parser.parse(activityOutput); ---> Error thrown here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2015 06:23 PM
Try var parser = new global.JSONParser();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-27-2015 06:54 AM
Looks like this worked for the OP and should work for you too:
gs.include("global.JSON");
var json = new global.JSON();
var parsed = json.decode(responseBody);