Why I am getting "GlideGuid is not allowed in scoped applications" error while executing the Scripted REST API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2020 08:55 AM
Hi
I am getting following error error while calling the Scripted REST API from REST API Explorer,
GlideGuid is not allowed in scoped applications
please find the code snippet below which is used inside scripted REST API.
var data = request.body.data;
var user_name = data.user_name;
var action_type = data.action_type;
var location = data.location;
// finding sys id of given user
var grUser = new GlideRecord('sys_user');
grUser.addQuery('name',user_name);
grUser.query();
if(grUser.next()){
user_id = grUser.getValue('sys_id');
}
// finding sys id of provided location
var grloc = new GlideRecord('cmn_location');
grloc.addQuery('name',location);
grloc.query();
if(grloc.next()){
location_id = grloc.getValue('sys_id');
}
// Creating Request, Requested Item and setting variables
var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId); //calling the cart API
var item = cart.addItem('b344************9b68a'); //Used proper sys_id
cart.setVariable(item, 'select_action', action_type);
cart.setVariable(item, 'location', location_id);
cart.setVariable(item, 'select_the_user_to_add_or_remove_vip_access', user_id);
var req = cart.placeOrder();
Regards,
Phalguna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2020 06:12 AM
Is this answered?
if my answer helped you, kindly mark response as ✅ Correct & 👍Helpful so that it does not appear in unanswered list & close the thread.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader