Difference between hasRole and hasRoleExactly?

Arvind Singh Ra
Kilo Guru

Difference between hasRole and hasRoleExactly?

2 REPLIES 2

Krishna  Penaka
Tera Expert

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

Omkar Mone
Mega Sage

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