ExamGecko
Question list
Search
Search

Question 19 - CAD discussion

Report
Export

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')
Answers
A.
g_user.hasRole('catalog_admin')
B.
g_user.hasRoleExactly('catalog_admin')
Answers
B.
g_user.hasRoleExactly('catalog_admin')
C.
g_user.hasRoleOnly('catalog_admin')
Answers
C.
g_user.hasRoleOnly('catalog_admin')
D.
g_user.hasRoleFromList('catalog_admin')
Answers
D.
g_user.hasRoleFromList('catalog_admin')
Suggested 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. References: [ServiceNow Docs - GlideUser API], [ServiceNow Community - Difference between hasRole() and hasRoleExactly()]

asked 23/09/2024
Mario Peralta
36 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first