Making a Service Catalog "Available For"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2016 07:37 AM
Hello. I have to set up a catalog of services so that it is visible only to Brazil's users.
I am using the following script:
var g = new GlideRecord ( ' sys_user ');
gr.addQuery ( 'country ', ' BR ');
gr.addActiveQuery ();
gr.query ();
gr.next ();
And it's not working. This script was written within the tab " Available for " catalog,
Can you help me please?
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2016 08:28 AM
Hi Rafel,
this way you can also restrict the visibility of your catalog.
Please refer the link below.
Legacy:Service Catalog Access Controls - ServiceNow Wiki
User Criteria - ServiceNow Wiki
Regards,
Harshvardhan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2016 08:36 AM
Hey,
Have tried using the User Criteria. It is more simpler than writing a script.
Just create a user criteria, add a country Brazil.
On the catalog item or category, add this User Criteria under the 'Available for' section
Regards,
VS

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2016 08:41 AM
Good day Rafael,
A simpler method would be to list the Brazilian locations in the location Glide list on the User Criteria form. The way you are trying to code this, only users at the top level of Brazil would have access to the Catalog. Locations should be found on the same form you are using to enter the code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2016 08:43 AM
Use the below script in the user criteria you have created for this.
checkAvailability();
function checkAvailability(){
var gr = new GlideRecord ('sys_user');
gr.get(gs.getUserID());
if (gr.country == 'BR') {
return true;
} else {
return false;
}
}
Thanks,
Mihir