> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# User

> Class for representing a user.

Class for representing a user.

## Constructors

### User()

```crmscript theme={null}
User
```

Class for representing a user.

## Methods

## getValue(String)

Gets the value of a given column.

```crmscript theme={null}
String getValue(String colName)
```

**Returns:** [CRMScript.Global.String](CRMScript.Global.String) - Returns a string with value in given column.

<Note>
  ### Possible values:

  | Value        | Type    | Description                                                                                          |
  | ------------ | ------- | ---------------------------------------------------------------------------------------------------- |
  | id           | Integer | The primary key (auto-incremented)                                                                   |
  | loginname    | String  | The unique loginname for this user.                                                                  |
  | username     | String  | The unique username for this user.                                                                   |
  | password     | String  | The encrypted password for this user.                                                                |
  | firstname    | String  | The firstname for this user.                                                                         |
  | middlename   | String  | The middlename for this user.                                                                        |
  | lastname     | String  | The lastname for this user.                                                                          |
  | email        | String  | The email address for this user.                                                                     |
  | status       | Integer | The status (enum) for this user. 1 is Active; 2 is Not Present; 3 is deleted                         |
  | signature    | String  | The users signature.                                                                                 |
  | language     | String  | A string indicating the user's language. See list below for values.                                  |
  | flags        | Integer | A bitmask indicating flags for this entry.                                                           |
  | lastCategory | Integer | The last chosen category for this user when posting tickets. category.id                             |
  | pictureId    | Integer | The attachment ID of the picture for this user.                                                      |
  | defaultUser  | Integer | The default user to set on new tickets in this category (1=automatically; 2=unassigned; 3=the owner) |
  | initials     | String  | Obsolete field. Cannot be removed because of not null error on older systems                         |
  | group        | Integer | The group ID of the primary group which this user belongs to                                         |
  | role         | Integer | The role ID of the role this user belongs to                                                         |
  | associateId  | Integer | The corresponding associate id for this user                                                         |
  | ownerCompany | Integer | the contact ID of the owning company of the users' connected person entity.                          |
  | x\_\*        |         | The extrafield with the given database field name.                                                   |

  ### Language values:

  | Value | Description |
  | ----- | ----------- |
  | 0     | Norwegian   |
  | 1     | English     |
  | 2     | German      |
  | 3     | Swedish     |
  | 4     | Danish      |
  | 5     | Dutch       |
  | 6     | French      |
  | 7     | Spanish     |
  | 8     | Italian     |
  | 9     | Czech       |
  | 10    | Finnish     |
  | 11    | Polish      |
  | 12    | Russian     |
  | 13    | Ukrainian   |

  ### Status: (Indicated by enums):

  | Flag               | Value |
  | ------------------ | ----- |
  | StatusNone         | 0     |
  | StatusNormal       | 1     |
  | StatusNotAvailable | 2     |
  | StatusDeleted      | 3     |
  | StatusReadOnly     | 4     |
  | StatusSpm          | 5     |
  | StatusSystem       | 127   |

  ### The different notify masks: (Indicated by bit enums):

  | Flag             | Value                              |
  | ---------------- | ---------------------------------- |
  | NewTicket        | 1                                  |
  | NewTicketMessage | 2                                  |
  | TicketEscalated  | 3                                  |
  | TicketActivated  | 4                                  |
  | ActiveTickets    | 5 //only used as a filter (ejuser) |
  | TicketTakeOver   | 6                                  |
  | Hotlist          | 9 //only used as a filter (ejuser) |
  | Custom           | 10                                 |

  ### Access flags:

  | Flag                         | Value           |
  | ---------------------------- | --------------- |
  | AccessNone                   | 0 (value 0)     |
  | AccessListOthers             | 0 bit number 1) |
  | AccessReadOthers             | 1               |
  | AccessEditOthers             | 2               |
  | AccessEditOwnPref            | 3               |
  | AccessCategoryAdministration | 4               |
  | AccessUserAdministration     | 5               |
  | AccessEjournalAdministration | 6               |
  | AccessStatistics             | 7               |
  | AccessDocuments              | 8               |
  | AccessJustCategory           | 9 //obsolete    |
  | AccessEditProfile            | 10              |
  | AccessListOnlyOwn            | 11              |
  | AccessReadOnlyOwn            | 12              |
  | AccessEditOnlyOwn            | 13              |
  | AccessChat                   | 14              |
  | AccessChatAdmin              | 15              |
  | AccessSpm                    | 16              |
  | AccessEditFaq                | 17              |
  | AccessFaqAdmin               | 18              |
  | AccessListExtraTablesContent | 19              |
  | AccessEditExtraTablesContent | 20              |
  | AccessReadSelections         | 21              |
  | AccessEditSelections         | 22              |
  | AccessPostToFacebook         | 23              |

  ### User flags:

  \<table>\<thead>\<tr>\<th>Flag\</th>\<th>Value\</th>\</tr>\</thead>\<tbody>\<tr>\<td>None\</td>\<td>0\</td>\</tr>\<tr>\<td>UseLastCategory\</td>\<td>1\</td>\</tr>\<tr>\<td>DefaultTicketClose\</td>\<td>2\</td>\</tr>\<tr>\<td>DefaultMessageClose\</td>\<td>3\</td>\</tr>\<tr>\<td>SortDesc\</td>\<td>4\</td>\</tr>\<tr>\<td>PreviewImages\</td>\<td>5\</td>\</tr>\<tr>\<td>OnlyOwnCategories\</td>\<td>6\</td>\</tr>\<tr>\<td>SmallFonts\</td>\<td>7\</td>\</tr>\<tr>\<td>InsertLastMessage\</td>\<td>8\</td>\</tr>\<tr>\<td>ShowQuickSearch\</td>\<td>9\</td>\</tr>\<tr>\<td>Use24HrsClock\</td>\<td>10\</td>\</tr>\<tr>\<td>AddMessageNewWindow\</td>\<td>11\</td>\</tr>\<tr>\<td>OnlyShowOpenTicketsInHotlist\</td>\<td>12\</td>\</tr>\<tr>\<td>UseLocalClock\</td>\<td>13\</td>\</tr>\<tr>\<td>HighlightActiveScreenElement\</td>\<td>14\</td>\</tr>\<tr>\<td>DisplayOwnCategories\</td>\<td>15\</td>\</tr>\<tr>\<td>SuppressWarnOnNavigate\</td>\<td>16\</td>\</tr>\<tr>\<td>SuppressPreviewWarning\</td>\<td>17\</td>\</tr>\<tr>\<td>PlainTextEditor\</td>\<td>18\</td>\</tr>\<tr>\<td>FckEditorSingleLineBreak\</td>\<td>19\</td>\</tr>\<tr>\<td>CustomDateFormat\</td>\<td>20\</td>\</tr>\<tr>\<td>SundayFirstDayInWeek\</td>\<td>21\</td>\</tr>\<tr>\<td>OldScreensOnEditTicket\</td>\<td>22\</td>\</tr>\<tr>\<td>KeepFormattingOnPaste\</td>\<td>23\</td>\</tr>\<tr>\<td>DisplayCheckboxLeft\</td>\<td>24\</td>\</tr>\<tr>\<td>ShowMessagesAsPlainText\</td>\<td>25\</td>\</tr>\<tr>\<td>HasSOWinLicense\</td>\<td>26\</td>\</tr>\<tr>\<td>HasSOWebLicense\</td>\<td>27\</td>\</tr>\<tr>\<td>HasSpmCal\</td>\<td>28\</td>\</tr>\<tr>\<td>HasMailMergeCal\</td>\<td>29\</td>\</tr>\<tr>\<td>HasChatCal\</td>\<td>30\</td>\</tr>\</thead>\<tbody>
</Note>

## hasTicketAccess(Integer,Integer)

Returns true if the user have at least the given access to the given ticket id.

```crmscript theme={null}
Bool hasTicketAccess(Integer ticketId, Integer accessLevel)
```

**Returns:** [CRMScript.Global.Bool](CRMScript.Global.Bool)

## isAdministrator()

Returns true if the user is an administrator, false if not.

```crmscript theme={null}
Bool isAdministrator()
```

**Returns:** [CRMScript.Global.Bool](CRMScript.Global.Bool)

## isLoggedIn(Integer)

Checks if a user is logged in or not.

```crmscript theme={null}
Bool isLoggedIn(Integer origin)
```

**Returns:** [CRMScript.Global.Bool](CRMScript.Global.Bool)

## load(Integer)

Loads a user from the database

```crmscript theme={null}
Bool load(Integer p_id)
```

**Returns:** [CRMScript.Global.Bool](CRMScript.Global.Bool) - True if the user is loaded successfully.

## loadFromAgentAndKey(Integer,String)

Loads a user from an Agent with userId and the Agent's key.

```crmscript theme={null}
Bool loadFromAgentAndKey(Integer id, String Key)
```

**Returns:** [CRMScript.Global.Bool](CRMScript.Global.Bool) - True if the user is loaded successfully.

## save()

Saves a user object to the database, returns the ID of the user.

```crmscript theme={null}
Integer save()
```

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer) - Returns the ID of the user.

## setValue(String,String,String)

Sets a value in a given column.

```crmscript theme={null}
Void setValue(String column, String value)
```

**Returns:** [CRMScript.Global.Void](CRMScript.Global.Void)

<Note>
  ### Possible values:

  | Value        | Type    | Description                                                                                          |
  | ------------ | ------- | ---------------------------------------------------------------------------------------------------- |
  | id           | Integer | The primary key (auto-incremented)                                                                   |
  | loginname    | String  | The unique loginname for this user.                                                                  |
  | username     | String  | The unique username for this user.                                                                   |
  | password     | String  | The encrypted password for this user.                                                                |
  | firstname    | String  | The firstname for this user.                                                                         |
  | middlename   | String  | The middlename for this user.                                                                        |
  | lastname     | String  | The lastname for this user.                                                                          |
  | email        | String  | The email address for this user.                                                                     |
  | status       | Integer | The status (enum) for this user. 1 is Active; 2 is Not Present; 3 is deleted                         |
  | signature    | String  | The users signature.                                                                                 |
  | language     | String  | A string indicating the user's language. See list below for values.                                  |
  | flags        | Integer | A bitmask indicating flags for this entry.                                                           |
  | lastCategory | Integer | The last chosen category for this user when posting tickets. category.id                             |
  | pictureId    | Integer | The attachment ID of the picture for this user.                                                      |
  | defaultUser  | Integer | The default user to set on new tickets in this category (1=automatically; 2=unassigned; 3=the owner) |
  | initials     | String  | Obsolete field. Cannot be removed because of not null error on older systems.                        |
  | group        | Integer | The group ID of the primary group which this user belongs to                                         |
  | role         | Integer | The role ID of the role this user belongs to                                                         |
  | associateId  | Integer | The corresponding associate id for this user                                                         |
  | ownerCompany | Integer | the contact ID of the owning company of the users' connected person entity.                          |
  | x\_\*        |         | The extrafield with the given database field name.                                                   |

  ### Language values:

  | Value | Description |
  | ----- | ----------- |
  | 0     | Norwegian   |
  | 1     | English     |
  | 2     | German      |
  | 3     | Swedish     |
  | 4     | Danish      |
  | 5     | Dutch       |
  | 6     | French      |
  | 7     | Spanish     |
  | 8     | Italian     |
  | 9     | Czech       |
  | 10    | Finnish     |
  | 11    | Polish      |
  | 12    | Russian     |
  | 13    | Ukrainian   |

  ### Status: (Indicated by enums):

  | Flag               | Value |
  | ------------------ | ----- |
  | StatusNone         | 0     |
  | StatusNormal       | 1     |
  | StatusNotAvailable | 2     |
  | StatusDeleted      | 3     |
  | StatusReadOnly     | 4     |
  | StatusSpm          | 5     |
  | StatusSystem       | 127   |

  ### The different notify masks: (Indicated by bit enums):

  | Flag             | Value                              |
  | ---------------- | ---------------------------------- |
  | NewTicket        | 1                                  |
  | NewTicketMessage | 2                                  |
  | TicketEscalated  | 3                                  |
  | TicketActivated  | 4                                  |
  | ActiveTickets    | 5 //only used as a filter (ejuser) |
  | TicketTakeOver   | 6                                  |
  | Hotlist          | 9 //only used as a filter (ejuser) |
  | Custom           | 10                                 |

  ### Access flags:

  | Flag                         | Value           |
  | ---------------------------- | --------------- |
  | AccessNone                   | 0 (value 0)     |
  | AccessListOthers             | 0 bit number 1) |
  | AccessReadOthers             | 1               |
  | AccessEditOthers             | 2               |
  | AccessEditOwnPref            | 3               |
  | AccessCategoryAdministration | 4               |
  | AccessUserAdministration     | 5               |
  | AccessEjournalAdministration | 6               |
  | AccessStatistics             | 7               |
  | AccessDocuments              | 8               |
  | AccessJustCategory           | 9 //obsolete    |
  | AccessEditProfile            | 10              |
  | AccessListOnlyOwn            | 11              |
  | AccessReadOnlyOwn            | 12              |
  | AccessEditOnlyOwn            | 13              |
  | AccessChat                   | 14              |
  | AccessChatAdmin              | 15              |
  | AccessSpm                    | 16              |
  | AccessEditFaq                | 17              |
  | AccessFaqAdmin               | 18              |
  | AccessListExtraTablesContent | 19              |
  | AccessEditExtraTablesContent | 20              |
  | AccessReadSelections         | 21              |
  | AccessEditSelections         | 22              |
  | AccessPostToFacebook         | 23              |

  ### User flags:

  \<table>\<thead>\<tr>\<th>Flag\</th>\<th>Value\</th>\</tr>\</thead>\<tbody>\<tr>\<td>None\</td>\<td>0\</td>\</tr>\<tr>\<td>UseLastCategory\</td>\<td>1\</td>\</tr>\<tr>\<td>DefaultTicketClose\</td>\<td>2\</td>\</tr>\<tr>\<td>DefaultMessageClose\</td>\<td>3\</td>\</tr>\<tr>\<td>SortDesc\</td>\<td>4\</td>\</tr>\<tr>\<td>PreviewImages\</td>\<td>5\</td>\</tr>\<tr>\<td>OnlyOwnCategories\</td>\<td>6\</td>\</tr>\<tr>\<td>SmallFonts\</td>\<td>7\</td>\</tr>\<tr>\<td>InsertLastMessage\</td>\<td>8\</td>\</tr>\<tr>\<td>ShowQuickSearch\</td>\<td>9\</td>\</tr>\<tr>\<td>Use24HrsClock\</td>\<td>10\</td>\</tr>\<tr>\<td>AddMessageNewWindow\</td>\<td>11\</td>\</tr>\<tr>\<td>OnlyShowOpenTicketsInHotlist\</td>\<td>12\</td>\</tr>\<tr>\<td>UseLocalClock\</td>\<td>13\</td>\</tr>\<tr>\<td>HighlightActiveScreenElement\</td>\<td>14\</td>\</tr>\<tr>\<td>DisplayOwnCategories\</td>\<td>15\</td>\</tr>\<tr>\<td>SuppressWarnOnNavigate\</td>\<td>16\</td>\</tr>\<tr>\<td>SuppressPreviewWarning\</td>\<td>17\</td>\</tr>\<tr>\<td>PlainTextEditor\</td>\<td>18\</td>\</tr>\<tr>\<td>FckEditorSingleLineBreak\</td>\<td>19\</td>\</tr>\<tr>\<td>CustomDateFormat\</td>\<td>20\</td>\</tr>\<tr>\<td>SundayFirstDayInWeek\</td>\<td>21\</td>\</tr>\<tr>\<td>OldScreensOnEditTicket\</td>\<td>22\</td>\</tr>\<tr>\<td>KeepFormattingOnPaste\</td>\<td>23\</td>\</tr>\<tr>\<td>DisplayCheckboxLeft\</td>\<td>24\</td>\</tr>\<tr>\<td>ShowMessagesAsPlainText\</td>\<td>25\</td>\</tr>\<tr>\<td>HasSOWinLicense\</td>\<td>26\</td>\</tr>\<tr>\<td>HasSOWebLicense\</td>\<td>27\</td>\</tr>\<tr>\<td>HasSpmCal\</td>\<td>28\</td>\</tr>\<tr>\<td>HasMailMergeCal\</td>\<td>29\</td>\</tr>\<tr>\<td>HasChatCal\</td>\<td>30\</td>\</tr>\</thead>\<tbody>
</Note>

## toParser(Parser)

Loads a user and returns it to a given Parser.

```crmscript theme={null}
Void toParser(Parser parser)
```

**Returns:** [CRMScript.Global.Void](CRMScript.Global.Void)


## Related topics

- [Users](/en/admin/user-management/index.md)
- [User contexts](/en/developer-portal/getting-started/user-contexts.md)
- [Add users](/en/admin/user-management/add-associate.md)
- [Validate User](/en/api/reference/restful/agent/user_agent/validate-user.md)
- [Add a user](/en/developer-portal/partner/add-user.md)
- [Update users](/en/admin/user-management/update-user.md)
