- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2022 12:27 PM
How to set the user criteria to us users only? I have a catalog item I want to be visible only to users in the US and there's no group containing all US users.
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2022 01:06 PM
Hi Astanley,
Kindly update the script as below
var userGR = new GlideRecord('sys_user');
userGR.addQuery('sys_id','user_id');//country=US^active=true
userGR.query();
if (userGR.next()) {
if(userGR.location.country == 'US')
{
answer = true;
}
else{
answer = false;
}
}
Regards,
Deepankar Mathur

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2022 12:30 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2022 12:49 PM
Hello, I appreciate the assistance. Can you please share the script I can use. The country I am using is US.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2022 12:56 PM
I have used the following however, it is not visible to users with the country US.
var userGR = new GlideRecord('sys_user');
userGR.addEncodedQuery('country=US^active=true');//country=US^active=true
userGR.addQuery('sys_id',gs.getUserID());
userGR.query();
if (userGR.next()) {
answer = true;
} else {
answer = false;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2022 01:06 PM
Hi Astanley,
Kindly update the script as below
var userGR = new GlideRecord('sys_user');
userGR.addQuery('sys_id','user_id');//country=US^active=true
userGR.query();
if (userGR.next()) {
if(userGR.location.country == 'US')
{
answer = true;
}
else{
answer = false;
}
}
Regards,
Deepankar Mathur