- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-19-2026 02:09 AM
while i was trying to make use of gs.hasRoleExactly('any_role') it was actually returning undefined can anyone please explain this
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-19-2026 10:13 AM
The hasRoleExactly method is not defined in the GlideSystem API, so that makes it undefined.
On client-side scripts you can use the GlideUser API: g_user.hasRoleExactly...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-19-2026 10:22 AM - edited ā01-19-2026 10:23 AM
Hi @Jagadeesh_Maddi ,
hasRoleExactly() can be used in the client side scripting using g_form.hasRoleExactly()
The GlideUser (g_user) Class | ServiceNow Developers
On server-side scripting, you can use gs.hasRole().
If my response helped, please mark it as the accepted solution so others can benefit as well.
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-19-2026 10:39 AM - edited ā01-19-2026 10:41 AM
@Brad Bowman and @miftikhar20 have answered your question.
Also this is one of important question for CAD certification . I have discussed about it in my article, you can have a read about it:
Thanks and Regards,
Mohammed Zakir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-19-2026 10:13 AM
The hasRoleExactly method is not defined in the GlideSystem API, so that makes it undefined.
On client-side scripts you can use the GlideUser API: g_user.hasRoleExactly...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-19-2026 10:22 AM - edited ā01-19-2026 10:23 AM
Hi @Jagadeesh_Maddi ,
hasRoleExactly() can be used in the client side scripting using g_form.hasRoleExactly()
The GlideUser (g_user) Class | ServiceNow Developers
On server-side scripting, you can use gs.hasRole().
If my response helped, please mark it as the accepted solution so others can benefit as well.
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-19-2026 10:39 AM - edited ā01-19-2026 10:41 AM
@Brad Bowman and @miftikhar20 have answered your question.
Also this is one of important question for CAD certification . I have discussed about it in my article, you can have a read about it:
Thanks and Regards,
Mohammed Zakir

