Referenced from: https://developer.servicenow.com/dev.do#!/reference/api/utah/server/no-namespace/c_GlideUserScopedAPI
and posted here for easy access.
| Method | Returns | Example |
|---|---|---|
| getCompanyID() | Returns the current user’s company sys_id. | gs.getUser().getCompanyID(); |
| getDisplayName() | Returns the current user’s display name. | gs.getUser().getDisplayName(); |
| getDomainID() | Returns the identifier of the user’s current session domain. | gs.getUser().getDomainID(); |
| getEmail() | Returns the user’s email address. | gs.getUser().getEmail(); |
| getFirstName() | Returns the user’s first name. | gs.getUser().getFirstName(); |
| getID() | Gets the sys_id of the current user. | gs.getUser().getID(); |
| getLastName() | Returns the user’s last name. | gs.getUser().getLastName(); |
| getName() | Returns the user ID, or login name, of the current user. | gs.getUser().getName(); |
| getPreference(String name) | Gets the specified user preference value for the current user. | gs.getUser().getPreference(String name); |
| getRoles() | Returns a list of roles that includes explicitly granted roles, inherited roles, and roles acquired by group membership. | gs.getUser().getRoles(); |
| 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.getUser().getUserRoles(); |
| hasRole(String role) | Determines if the current user has the specified role. | gs.getUser().hasRole(String role); |
| isMemberOf(String group) | Determines if the current user is a member of the specified group. | gs.getUser().isMemberOf(String group); |
| savePreference(String name, String value) | Saves a user preference value to the database. | gs.getUser().savePreference(String name, String value); |
