how can i hide an icon link widget based on roles or groups?

ads4
Kilo Guru

I need to hide an icon link widget based on role, for ex. if user has abc role he should not see the icon link widget but if he has xyz role he should see it

1 ACCEPTED SOLUTION

Sebastian L
Mega Sage

See this article on how to activate user criteria for Service Portal: 

https://docs.servicenow.com/bundle/sandiego-servicenow-platform/page/build/service-portal/concept/user-criteria.html 

 

Please read it through before activating


Best regards,
Sebastian Laursen

View solution in original post

6 REPLIES 6

Sebastian L
Mega Sage

Depending if you have the property "glide.service_portal.user_criteria_enabled" enabled, which gives you user criteria for portal pages and widgets. If not, then there is a field called "Roles" on the widget, in where you can add the role required to see the widget. 

But I would properly set it on the instance instead.. You can also use the field "Roles" there to apply the role, or if you have the user criteria, set it accordingly. 


Best regards,
Sebastian Laursen

Saurav11
Kilo Patron
Kilo Patron

Hello,

You can right ctrl + right click on the icon widget on Portal Na click on the Instance option

find_real_file.png

 

Then click on three dots and click on Open in Platform

find_real_file.png

There in the behaviour tab you will see the role option where you can add the roles and restrict it

find_real_file.png

 

Please mark answer correct/helpful based on Impact.

Hello,

adding a role here would make this widget visible to users with that role, but what if i want to put a check that certain users with xyz role should not see this widget. I.e i want to hide it only from users having xyz

Hello,

Then just create a user criteria.

After creating go to the m2m_sp_instance_uc_can_view table and click on new record and add the Widget instance and the user criteria

find_real_file.png

To get the Instance name of the widget  ctrl + right click on the icon widget on Portal and click on the Instance option

There in the title you will see the name for the instance:-

find_real_file.png

Please mark answer correct/helpful based on Impact