User criteria restriction to access a catalog item

rajasekharteja
Tera Guru

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

 

 

 

 

4 REPLIES 4

Pratiksha Kalam
Kilo Sage

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

@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.

try to   remove "  not " from script . n let me know anything is missing

 

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.