Servicenow Certified Application Developer CAD · Free Practice Question Easy
Question 31
Which one of the following is true for GlideUser (g_user) methods?
-
A
Can be used in Business Rules only
-
B
Can be used in Client Scripts, UI Policies, and UI Actions
-
C
Can be used in Client Scripts and UI Policies only
-
D
Can be used in Business Rules, and Scripts Includes
Reveal correct answer
Correct answer: B
Explanation
Source: Community
Correct Answers:
"Can be used in Client Scripts, UI Policies, and UI Actions"
Client Scripts: In the context of Client Scripts, g_user provides methods to access and manipulate user-specific information on the client-side. For example, you can use g_user to check the current user's roles, preferences, and session details to customize form behavior based on the user's attributes.
UI Policies: In UI Policies, g_user methods can be used to determine user-related conditions and control the visibility or read-only properties of form elements dynamically. By leveraging g_user, you can define UI Policies that react to user input or specific user roles.
UI Actions: Similarly, when defining UI Actions, g_user can be utilized to perform user-specific actions or validations before executing a particular action. For instance, you can use g_user to check if the current user has the necessary roles or permissions before allowing them to trigger a UI Action.
Incorrect Answers:
Can be used in Client Scripts and UI Policies only: This is incorrect. GlideUser (g_user) methods can also be used in UI Actions in addition to Client Scripts and UI Policies.
Can be used in Business Rules only: This is incorrect. GlideUser (g_user) methods are specific to the client-side scripting API and are not used in Business Rules, which are server-side scripts.
Can be used in Business Rules and Script Includes: This is incorrect. While GlideUser (g_user) methods are used in client-side scripts like Client Scripts, UI Policies, and UI Actions, they are not part of server-side scripting and are not used in Script Includes or Business Rules.
Understanding where and how to use GlideUser (g_user) methods on the client-side is essential for developers to create dynamic and user-centric applications in ServiceNow. These methods empower developers to tailor user experiences, implement role-based behavior, and enforce proper access controls in the user interface.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
