- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2016 05:10 AM
Hi,
I want to hide a catalog item based on role.
For
role 1 : All Catalog item should be enable
role 2: Last 2 catalog items only enable.
Please help me to fix this.
Regards,
RK
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2018 09:37 PM
Hi,
1. Create a new User Criteria > Give it a meaningful name > Check "Advance",in script section add following code :
if(!user.hasRole("role_who_can_view_item"))
{
condition =false;//set visiility to false if user don't have "role_who_can_view_item" role
}
OR
Configure > Related Lists > Pull Not Available for / Not available for Group and configure it.
Also, double check whether the group from whom you are hiding the items have the correct role.
Refer : Catalog item visibility in ServiceNow
Regards,
Ajay

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2016 05:17 AM
Use before query business rules.Scripting in Business Rules - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2016 05:56 AM
Hi Surya,
Thanks for your response.
Please share me, if you have any sample code. It will very helpful for me.
Regards,
RK

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2016 05:28 AM
Hi RK,
You can restrict or show catalog items using User Criteria. These are flexible to allow you to define groups of people based on role, group, location, and more then determine if you want to allow or deny access to an item based on that group of people. These are far superior to the simple roles we used to have on catalog items in the past.
User Criteria - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2016 05:54 AM
Hi,
I have created a new user criteria and added the role to restrict, but where I need to call this User Criteria in Catalog Item?
Thanks for understanding,
RK