Setting role on Widget Instance does not affect the visibility
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2024 07:36 AM - edited 11-07-2024 07:41 AM
Widget name: Icon Link
Widget Roles (sp_widget.roles): snc_internal, snc_external
Widget Instance Roles (sp_instance.roles): custom_role1, custom_role2
There are 4 widget instances that are on the index page of the portal. I need one of them (widget instance with roles above) to not be shown unless these custom roles are on the user viewing it.
Constraint: Widget's server code to set data.show or similar and use it in ng-if in the HTML should not be used.
However, all widget instances will be are seen on the portal page even by a user without any roles. I am trying to find out why and this seems so basic and baseline from ServiceNow not to work.
Does anybody know the order of importance for these roles fields?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2024 07:45 AM
Role Resolution Order (most specific to least specific):
- Widget Instance Roles (sp_instance.roles) - Most specific
- Widget Roles (sp_widget.roles) - Less specific
- Page Roles (sp_page.roles) - Least specific
In your case, the issue is likely happening because:
- The Widget has snc_internal, snc_external roles (basic portal access)
- The Instance has custom_role1, custom_role2
- When a widget instance has roles specified, it should theoretically only show to users with those roles
Troubleshooting Steps:
- Verify the custom roles exist and are properly assigned
- Check if there's a portal property overriding role checks
- Verify the role names are exact matches (case sensitive)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2024 12:59 AM - edited 11-13-2024 01:01 AM
Thank you, this did help and is factual.
I have found the root cause, basically someone implemented two rows of exactly the same widgets and when looking at the page tree for widget instances I was updating the wrong row which was invisible (depends on some roles the user has). Because of this there were more than 4 widgets, 8 to be exact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2024 01:41 AM
Good catch on tracking down the root cause. These kinds of role-based visibility issues can be super tricky to spot, especially when you've got duplicate widgets involved😅.