How to hide catalog item base on role?

firemoon
Mega Expert

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.

find_real_file.png

Regards,
RK

1 ACCEPTED SOLUTION

Ajaykumar1
Tera Guru

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

View solution in original post

18 REPLIES 18

I figured something was off!   I'll contact them today and see what they say!   Thanks for your time!



Fred


briet
Kilo Contributor

Hi Fred!



Did you find a solution for this? I have the exact same behaviour occurring.



Thanks!



Brie


Hello Chuck,

somehow I can't see the tabs for "Available for" and "Not available for" on my catalog item,
nor is the "Roles" field visible.

Could you please tell me how to make those visible/accessible.

Many thanks in advance,
Jack

Chuck,



Looking for absolute clarification here please . . . .



We currently use Roles on our items (We're running Eureka now) and have been for years.



We're making the jump to Helsinki and have noticed that the Role field is no longer displayed on the form and that the roles no longer seem to be honored.   Everybody sees everything.



What I'm hearing is that the use of Roles directly on an Item has been deprecated?   And instead we need to 'User Criteria'?



Thanx in advance for the clarification,



Sandy


Hi Sandra,



Thank you for clarifying. I wasn't aware you were using Eureka. User Criteria came out in Fuji so your upgrade will enable you greater flexibility and less maintenance/management with User Criteria. That's the best way to manage access to items (and knowledge) in the future.