GlideUser
What is GlideUser
gs.getUser()
is used pretty heavily to control access and other things
in Servicenow. I go over all the methods and properties of those below.
Method | Scoped | Global |
---|---|---|
getCompanyID | Scoped | Global |
getDisplayName | Scoped | Global |
getEmail | Scoped | Global |
getFirstName | Scoped | Global |
getID | Scoped | Global |
getLastName | Scoped | Global |
getName | Scoped | Global |
getRoles | Scoped | Global |
getUserRoles | Scoped | Global |
hasRole | Scoped | Global |
isMemberOf | Scoped | Global |
getPreference | Scoped | |
savePreference | Scoped | |
getDomainDisplayValue | Global | |
getManagerID | Global | |
getMyGroups | Global | |
getLanguage | Global | |
getDepartmentID | Global | |
getLocation | Global | |
getCompanyRecord | Global | |
getDomainID | Global |
Server
getCompanyID
Returns the current user's company sys_id.
getDisplayName
Returns the current user's display name.
getDomainDisplayValue
Returns the display value of the user's session domain.
Note: There is no workaround for scoped applications.
getEmail
Returns the user's email address.
getFirstName
Returns the user's first name.
getID
Gets the sys_id of the current user.
getLastName
Returns the user's last name.
getName
Returns the user ID, or login name, of the current user.
getPreference
Gets the specified user preference value for the current user.
getRoles
Returns a list of roles that includes explicitly granted roles, inherited roles, and roles acquired by group membership.
getUserRoles
Returns the list of roles explicitly granted to the user.
Unlike the getRoles() method, this method does not return roles the user inherits or roles acquired from group membership.
gs hasRole
Determines if the current user has the specified role.
isMemberOf
Determines if the current user is a member of the specified group.
NOTE: This only takes a text string of the name.
savePreference
Saves a user preference value to the database.
getMyGroups
Returns the list the user's groups.
getUserByID
Returns the user object by the user's id.
getLanguage
Returns the user language.
getDeparmentID
Returns undefined.
getLocation
Returns empty string regardless of the user's "location" value.
getCompanyRecord
Returns GlideRecord to core_company
record.
getDomainID
Returns domain id or null.