- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2020 01:24 AM
Can the visibility of the catalog item (service catalog) can be restricted by employee type?
I want to restrict access for a catalog item of employee type contractors.
What is the best can be be done for this, so that no contractors can see the catalog item?
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2020 01:44 AM
Hi Namita,
You should be able to restrict the visibility of the catalog items via User criteria (Advanced Script).
Script below:
checkEmployeeType();
function checkEmployeeType() {
var user = new GlideRecord('sys_user');
user.get(gs.getUserID());
user.query();
if (user.u_employee_type == 'contractor') //assuming u_employee_type is the column name
{
return false;
}
return true;
}
Details here https://docs.servicenow.com/bundle/orlando-it-service-management/page/product/service-catalog-manage...
- Pradeep Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2020 01:42 AM
Hi Namita,
Assuming, you have a field "Employee Type" in your user table. In the catalog item, under available for you can GlideRecord and get the sys_id for users you are not contractors.
var gr = new GlideRcord('sys_user');
gr.addQuery('employee_type','!=','contractor');
gr.addQuery('sys_id',gs.getUserID());
gr.query();
if(gr.next())
{
return true;
}
Please mark reply as Correct/Helpful, if applicable. Thanks!
Regards,
Tanvi

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2020 01:44 AM
Hi Namita,
You should be able to restrict the visibility of the catalog items via User criteria (Advanced Script).
Script below:
checkEmployeeType();
function checkEmployeeType() {
var user = new GlideRecord('sys_user');
user.get(gs.getUserID());
user.query();
if (user.u_employee_type == 'contractor') //assuming u_employee_type is the column name
{
return false;
}
return true;
}
Details here https://docs.servicenow.com/bundle/orlando-it-service-management/page/product/service-catalog-manage...
- Pradeep Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 07:41 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 07:46 PM
You are very welcome Namita.