ServiceNow Certified Application Developer — Question 167
Which method call returns true only if the currently logged in user has the catalog_admin role and in no other case?
Answer options
- A. g_user.hasRole('catalog_admin')
- B. g_user.hasRoleExactly('catalog_admin')
- C. g_user.hasRoleOnly('catalog_admin')
- D. g_user.hasRoleFromList('catalog_admin')
Correct answer: B
Explanation
The correct answer is B, g_user.hasRoleExactly('catalog_admin'), as it checks if the user has only that specific role without any others. Option A returns true if the user has the role but does not check for exclusivity. Options C and D do not exist in the ServiceNow API, making them invalid choices.