Which function is used to verify exact role membership for a specific role?

Prepare for the ServiceNow CAD Exam with comprehensive flashcards and multiple-choice questions. Each query offers hints and explanations. Ensure your success on the exam!

Multiple Choice

Which function is used to verify exact role membership for a specific role?

Explanation:
This tests how to check exact role membership on the client side using the GlideUser object. The correct way is g_user.hasRoleExactly('pa_admin') because this function verifies that the current user’s assigned roles are exactly the specified one, with no other roles included. That exact-match behavior is what you need when you must enforce that a user holds only that role and nothing else. Using g_user.hasRole('pa_admin') would return true if the user has that role, but it doesn’t guarantee there aren’t other roles attached, so it isn’t an exact check. A form like hasRoleExactly('pa_admin') without the g_user prefix isn’t valid in this context, and verifyRoleExact('pa_admin') isn’t a standard ServiceNow API function.

This tests how to check exact role membership on the client side using the GlideUser object. The correct way is g_user.hasRoleExactly('pa_admin') because this function verifies that the current user’s assigned roles are exactly the specified one, with no other roles included. That exact-match behavior is what you need when you must enforce that a user holds only that role and nothing else.

Using g_user.hasRole('pa_admin') would return true if the user has that role, but it doesn’t guarantee there aren’t other roles attached, so it isn’t an exact check. A form like hasRoleExactly('pa_admin') without the g_user prefix isn’t valid in this context, and verifyRoleExact('pa_admin') isn’t a standard ServiceNow API function.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy