- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2020 04:47 AM
Hi,
I am getting error message
{"error":{"message":"Illegal access to private script include JSONParser in scope rhino.global being called from scope sn_customerservice","detail":"Illegal access to private script include JSONParser in scope rhino.global being called from scope sn_customerservice"},"status":"failure"}
(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
body = global.JSON.stringify(request.body.data);
return new createCase().create(body);
})(request, response);
And in script include I have below code;
var createCase = Class.create();
createCase.prototype = {
initialize: function() {
},
create: function(values) {
gs.info('function called');
var parser = new global.JSONParser();
var parsed = parser.parse(values);
// var json = new global.JSON();
// var parsed = new JSON().decode(values.json_output.toString());
var sd = parsed.short_description;
}
return sd;
},
type: 'createCase'
};
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2020 04:55 AM
Also instead of using JSONParser, you can straightaway use JSON.parse(values) and JSON.stringify() methods which does the same job also which are JS methods so wont throw any error of this kind.
Hope this helps.
Regards
Omkar Mone

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2020 05:54 AM
Hi
You can put the code in the try{}catch(e){} block and get the errors.
Regards
Omkar Mone
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2020 07:22 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2020 10:39 PM
Hi
You can do it something like this -
try{}catch(err){gs.log('Got Error: ' + err);}
Regards
Omkar Mone