- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2025 05:04 AM
Hi Everyone,
I have a requirement that, I need to restrict access to one tab in the portal to specific groups(SIT user & UAT user) only,
But there are no direct group members in both the groups, there are multiple roles(Testing user role & align mgt) in both the groups.
I want to give access the users who are in both the groups (SIT user & UAT user).
Code:
if(gs.getUser().isMemberOf('SIT user') || if(gs.getUser.isMemberOf('UAT User') ){
data.testuser=true
}
result: false even the user is part of the role.
Can you please suggest me.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2025 05:49 AM
why are you giving user direct role?
Instead give role to group and add user to that group?
if those are not added in group then simply use this to check both the roles
gs.hasRole('role A') && gs.hasRole('roleB')
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2025 05:22 AM
Please use AND operator as mentioned by @Anurag Tripathi if that user should satisfy both the roles
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader