Which method call returns true only if the currently logged in user has the catalog_admin role and in no other case?
A . g_user.hasRole(‘catalog_admin’)
B . g_user.hasRoleExactly(‘catalog_admin’)
C . g_user.hasRoleOnly(‘catalog_admin’)
D . g_user.hasRoleFromList(‘catalog_admin’)
Answer: B
Explanation:
The method call that returns true only if the currently logged in user has the catalog_admin role and in no other case is g_user.hasRoleExactly(‘catalog_admin’). This method checks if the user has exactly one role, and returns true if it matches the argument. The other methods return true if the user has one or more roles, or if the user has any role from a list of arguments.
Reference: [ServiceNow Docs – GlideUser API], [ServiceNow Community – Difference between hasRole() and hasRoleExactly()]
Reference: https://community.servicenow.com/community?id=community_Question:&sys_id=dff705e6db7757c0d58ea345ca96196b
Latest CAD Dumps Valid Version with 60 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund