CAD practice question 14 of 35
Which one of the following is true for this script fragment? g_user.hasRole(,x_my_app_user');
Full set: 264 questionsguser represents the GlideUser client-side object. Its hasRole(String role) method “returns true if the currently logged-in user possesses the specified role OR is an administrator.” Therefore, the call guser.hasRole('xmyappuser') evaluates to true when the user either explicitly holds the xmyappuser role or holds the admin role, making option A the only correct statement.
B. Method returns false when the user lacks BOTH the role and admin; having the role makes it true, so statement is inaccurate.
C. guser.hasRole() is an officially documented method; it does exist.
D. Ignores the documented admin override, so it is incomplete/incorrect.
1. ServiceNow Product Documentation – “GlideUser (guser) API”, section “hasRole(String role)”, Orlando-Tokyo versions: “Returns true if the user has the role or is an administrator.”
URL: https://developer.servicenow.com/dev.do#!/reference/api/rome/client/cGlideUserAPI#guserhasRole
2. ServiceNow Product Documentation – “GlideSystem (gs) API”, section “hasRole(String role)”, confirms identical admin override behavior (supports consistency across client/server).
URL: https://developer.servicenow.com/dev.do#!/reference/api/rome/serverlegacy/cGlideSystemAPI#hasRole
Keep practicing
Take the free CAD practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other CAD practice questions
- Question 1Which options are strategies for debugging client-side scripts? Choose 2 answers
- Question 2Which of the following is a good practice for adding instructions to a form?
- Question 3Identify characteristic(s) of a Record Producer. Choose 3 answers
- Question 4Exportitem table is extended from Item table with the additional column of ItemCountry ad…
- Question 5Which one of the following is the fastest way to create and configure a Record Producer?
- Question 6On what part of the ServiceNow instance, would you find the option to Impersonate User?
