How to Maintain visibility conditions for component in ui builder servicenow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
9 hours ago
Hi All,
I have created a component on a Landing Page/Dashboard in UI Builder. The dashboard itself is visible to users belonging to 6 different groups, but there is a requirement that component should be visible only to 3 groups.
While configuring the component, I can see the Hide Component option with values True, False, and None. I tried using a script-based visibility condition, but it is not working as expected.
Could anyone please guide me on the correct approach to control component visibility based on user group membership in UI Builder?
I am new to UI Builder, so any suggestions or examples would be greatly appreciated.
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
9 hours ago
did you try using gs.getUser().isMemberOf() in that script and see if logged in user belongs to any of those groups?
based on that return true/false
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
9 hours ago
Hello @harinya ,
Refer this for step to step guide :
Practical UIB Examples: Hide a container/component based on the user's role
If my response helped mark as helpful and accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
8 hours ago
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
8 hours ago