g_user
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.
firstName
The current user's first name.
getClientData
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.
getFullName
Returns the first and last name of the current user.
hasRole
Returns true if the current user has the specified or admin role.
hasRoleExactly
Returns true only if the current user has the specified role.
hasRoleFromList
Returns true if the current user has at least one of the specified roles or has the admin role.
hasRoles
Returns true if the current user has any role.
lastName
The current user's last name.
userID
The sys_id of the current user.
userName
This property is the current user's username, for example gsmith02. It is not the user's name, for example George Smith.