---
title: "user and User"
site: api
version: 2027.1
versions: "all"
url: https://docs-new.servicely.ai/api/2027.1/scripting/platform/user/
type: reference
application: platform
last_updated: 2026-12-03
commit: 6777698daac5
---


Two globals describe the signed-in user. `user`, all lower case, is available in server scripts. `User`, with a capital U, is available in client scripts such as UI events.

## Get an instance

Both are ready to use. There is nothing to create.

```javascript
// Server script
let userId = user.getID();

// Client script
let clientUserId = User.getID();
```

## Server user methods

On the server, `user` also gives the fields of the user's record by name: `user.Email()` reads the **Email** field.

| Method | Returns | Description | Since |
| --- | --- | --- | --- |
| `getID()` | String | The ID of the user's record. | 1.11 |
| `getName()` | String | The user's full name. | 1.11 |
| `getUserName()` | String | The user name. | 1.11 |
| `getFirstName()` | String | The first name. | 1.11 |
| `getLastName()` | String | The last name. | 1.11 |
| `getEmail()` | String | The primary email address. | 1.11 |
| `getTitle()` | String | The job title. | 1.11 |
| `getDeskPhone()` | String | The desk phone number. | 1.11 |
| `getMobile()` | String | The mobile number. | 1.11 |
| `getTimeZone()` | String | The time zone ID from the user's record. | 1.11 |
| `getCompanyID()` | String | The ID of the user's company. | 1.11 |
| `getRecord()` | TableRecord | The user's record. | 1.11 |
| `getDisplayValue()` | String | The display value of the user's record. `displayValue()` is the same. | 1.11 |
| `evaluate(path)` | Any | The value at a dot path from the user's record, for example `"Company.Name"`. | 1.11 |
| `locale()` | String | The session's locale, for example `"en_US"`. | 1.11 |
| `getRoles()` | Array | The names of the user's roles. `getRoleNames()` is the same. | 1.11 |
| `getRoleIDs()` | Array | The IDs of the user's roles. | 1.11 |
| `hasRole(role)` | Boolean | True when the user holds the role, by name or ID. | 1.11 |
| `hasAnyRole(roles)` | Boolean | True when the user holds at least one of the roles. Pass names as separate arguments or as one array. | 1.11 |
| `hasEffectiveRole(role)` | Boolean | True when the session's effective user holds the role, by name or ID. | 1.11 |
| `isAdministrator()` | Boolean | True when the user holds `administrator`. | 1.11 |
| `isSystem()` | Boolean | True when the user holds `system`. | 1.11 |
| `getGroupNames()` | Array | The names of the user's groups. | 1.11 |
| `getGroupIDs()` | Array | The IDs of the user's groups. | 1.11 |
| `isMemberOfGroup(group)` | Boolean | True when the user is in the group, by name or ID. | 1.11 |
| `getProfileProperty(key)` | String | A value from the user's profile, or null. | 1.11 |
| `getProfileProperty(key, default)` | String | A value from the user's profile, or `default`. | 1.11 |
| `setProfileProperty(key, value)` | Nothing | Saves a value in the user's profile. | 1.11 |
| `isAuthenticated()` | Boolean | True when a user is signed in. | 1.11 |
| `isHardCodedUser()` | Boolean | True for a built-in user, such as the system user, or when nobody is signed in. | 1.11 |
| `isImpersonated()` | Boolean | True when the session is impersonating the user. | 1.11 |
| `getCurrentTenantID()` | String | The ID the tenancy filter uses now. With realm hierarchy tenancy, it is the realm chosen in the realm selector. Null without tenancy. | 1.11 |
| `getPrimaryTenantID()` | String | The ID of the user's own tenancy filter. With realm hierarchy tenancy, it is the realm on the user's record. Null without tenancy. | 1.11 |

| Method | Returns | Description | Since |
| --- | --- | --- | --- |
| `isAdminEscalated()` | Boolean | True when the session has escalated to administrator. | 2027.1 |
| `canEscalateToAdmin()` | Boolean | True when the user holds `administrator` but the session has not escalated, so the user could escalate. | 2027.1 |

## Client User methods

| Method | Returns | Description | Since |
| --- | --- | --- | --- |
| `getID()` | String | The ID of the user's record. | 1.11 |
| `getUserName()` | String | The user name. | 1.11 |
| `getFirstName()` | String | The first name. | 1.11 |
| `getLastName()` | String | The last name. | 1.11 |
| `getEmail()` | String | The primary email address. | 1.11 |
| `getTimeZone()` | String | The time zone ID. | 1.11 |
| `getLanguage()` | String | The user's language. | 1.11 |
| `getRoles()` | Array | The names of the user's roles. | 1.11 |
| `hasRole(role)` | Boolean | True when the user holds the role. | 1.11 |
| `isAuthenticated()` | Boolean | True when a user is signed in. | 1.11 |
| `getProperty(key, default)` | String | An application property marked **Client side accessible**, or `default` when it does not exist. | 1.11 |
| `getBooleanProperty(key, default)` | Boolean | The same, as a boolean. | 1.11 |
| `getIntegerProperty(key, default)` | Number | The same, as a whole number. | 1.11 |
| `getUserProfileProperty(key, default)` | String | A value from the user's profile, or `default`. | 1.11 |
| `getBooleanUserProfileProperty(key, default)` | Boolean | The same, as a boolean. | 1.11 |
| `getIntegerUserProfileProperty(key, default)` | Number | The same, as a whole number. | 1.11 |
| `setUserProfileProperty(key, value)` | Nothing | Saves a value in the user's profile. | 1.11 |

## Examples

### Check roles on the server

**Servicely Script**

```javascript
[
    user.hasRole("administrator"),
    user.hasAnyRole("itsm_manager", "knowledge_manager"),
    user.isMemberOfGroup("<group name>")
];
```

**Response**

```javascript
[false, true, true]
```

### Read a property in a client script

```javascript
if (User.getBooleanProperty("system.multilingual", false)) {
    current.<FieldName>.visible(true);
}
```

## Related

- [Client form API](page:scripting/client-form-api)
- [ApplicationPropertyManager](page:scripting/platform/application-property-manager)
- [RealmUtils](page:scripting/platform/realm-utils)
- [Multi-tenancy](page:admin/access/roles-and-permissions/multi-tenancy)
