What is g_user
g_user is used pretty heavily to control access and other things in
Servicenow. I go over all the methods and properties of those below.
The current user's first name.
Gets a session client value previously set with putClientData().
Session client data is a set of named strings that may be setup on the server (using putClientData()) that then may be used by client scripts (using getClientData()). Can be used during form load time to get information that the client script needs to make decisions about the form, for example, which fields should be visible.
Returns the first and last name of the current user.
Returns true if the current user has the specified or admin role.
Returns true only if the current user has the specified role.
Returns true if the current user has at least one of the specified roles or has the admin role.
Returns true if the current user has any role.
The current user's last name.
The sys_id of the current user.
This property is the current user's username, for example gsmith02. It is not the user's name, for example George Smith.