- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 08:47 AM
Hi Friends
I am working on some catalog item, and I have to restrict this catalog item based on user country,
I have tried using available with advance script like below, but its not working,
Any idea, or any other way we can achieve this?
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 08:52 AM
Hi,
Try this instead:
checkCondition();
function checkCondition(){
var user = new GlideRecord('sys_user');
user.get(gs.getUserID());
if (user.location.country == "USA")
{
return true;
}
return false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 09:55 AM
I am sorry, its working Kieran, thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 07:15 AM
Please try this one
var userGR = new GlideRecord('sys_user');
userGR.get('sys_id',user_id);
if (userGR.location.country == 'USA')
{
return true;
}
return false;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 09:42 AM
Use below code in your user criteria advanced script
checkCondition();
function checkCondition(){
var user = new GlideRecord('sys_user');
user.get(gs.getUserID());
if (user.location.country == "USA")
{
answer=true;
}
answer=false;
}
Regards,
Sachin