ServiceNow Certified Application Developer — Question 108
Which one of the following is true for this script fragment?
g_user.hasRole('x_my_app_user');
Answer options
- A. There is no g_user.hasRole() method
- B. The method returns false only if the currently logged in user has the x_my_app_user role
- C. The method returns true only if the currently logged in user has the x_my_app_user role
- D. The method returns true if the currently logged in user has the x_my_app_user role or the admin role
Correct answer: D
Explanation
The correct answer is D because the g_user.hasRole() method checks for multiple roles, including the admin role. Options A, B, and C are incorrect as they misrepresent the method's functionality and its return values regarding role checks.