User criteria restriction to access a catalog item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 03:59 AM
Hello Everyone,
I got a requirement where I need to show/hide catalog item to user.
If user have a only itil , approver role then the catalog item should be hidden , if user have additional roles along with Itil and approver then catalog item should be visible to the user.
I'm not getting how to get this query using addquery could you please help me on this one.
Thanks,
Raj

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 04:30 AM - edited 01-04-2024 04:31 AM
Hello,
Create a new User Criteria > provide name ---> Check "Advance",in script section :
if(!user.hasRole("role_who_can_view "))
{
condition =false;//set visibility 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.
If answer is helpful pls mark it as helpful or correct!
br,
pratiksha.k
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 04:37 AM
@Pratiksha Kalam Thanks for the reply.
As I stated above the criteria is user should see the catalog item only if additional roles are present along with Itil and approver roles.
If user have only Itil and approver catalog Item should be hidden to the user.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 05:42 AM
try to remove " not " from script . n let me know anything is missing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 06:49 AM - edited 01-04-2024 06:52 AM
user.hasRole("role_who_can_view "))
Current Scenario :
Both ITIL and approver should be able to see the catalog item only if user has an extra role along with these 2 roles i.e.., ITIL + approval + some extra role.
If user has only ITIL + approval then catalog item should be hidden.
but by seeing the code you have provided above i could see it's specific to only who can see or who cannot but the above scenario is different from the code.
Could you please suggest what could be done to achieve the above scenario.