Difference between hasRole and hasRoleExactly?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2019 10:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-12-2019 09:12 PM
Just an example use case for your understanding.
g_user.hasRole('itil') True if the current user has the role specified, false otherwise. ALWAYS returns true if the user has the 'admin' role.
So for admin it will return true
hasRoleExactly('itil') True if the current user has the exact role specified, false otherwise, regardless of 'admin' role.
Will return false for admin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-12-2019 09:16 PM
Hi
The below link will give you the clear idea about the differences in gs as well as g_user objects.
https://www.servicenowguru.com/scripting/user-object-cheat-sheet/
Hope this helps.
Regards
Omkar Mone