> ## 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.

# Create and update customers

> How to create and update customers.

## Void setValue(String column, String Value)

Sets a named field to the given value. Look up names in the reference section down below, or check out the [class reference][1].

<Note>
  Both parameters are strings! Remember to use quotes even for IDs.

  You must call `save()` after setting all applicable values to actually create or update the company.
</Note>

```crmscript theme={null}
User u;
u.load(9);
u.setValue("email", "bob@example.com");
u.save();
```

## Integer save()

Saves a new or updated user and returns its ID.

* If the ID is set before calling `save()`, it's an update.
* If the ID is empty, it's a create.

```crmscript! theme={null}
User u;
u.setValue("firstname", "Sam");
printLine(u.save().toString());
```

## Reference

### Frequently used values

| Parameter    | Db field    | Description                                          |
| :----------- | :---------- | :--------------------------------------------------- |
| id           | id          | ID (primary key)                                     |
| username     | username    | Unique username or uid                               |
| profileId    | profile\_id | The user's profile (profile.id)                      |
| firstname    | firstname   | The first name of the person                         |
| lastname     | lastname    | The last name of the person                          |
| email        | Email       | 1 or more                                            |
| ownerCompany |             | The ID of the company linked to user's person entity |
| group        | usergroup   | The primary group for the user                       |
| status       | status      | Status<br />active (1), not present(2), deleted (3)  |
| language     | language    | The user's language, see list below for values       |

#### 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   |

### Sign-in info

| Parameter        | Db field             | Description                                                             |
| :--------------- | :------------------- | :---------------------------------------------------------------------- |
| loginAttempts    | login\_attempts      | How many times the user has tried to sign in with an incorrect password |
| lastLoginAttempt | last\_login\_attempt | The last time the user tried to sign in but failed                      |
| idleTime         | idle\_time           | Duration in seconds the user has been idle                              |

### User flags and access flags

**User flags** represent preferences. For example, Use24HrsClock = 10.

**Access flags** represent what a user may do. For example, AccessDocuments = 8.

### Ticket notifications

Notifications (pop-up warnings) to the user are controlled by a bit mask.

| Value | Description            |
| :---: | ---------------------- |
|   1   | NewTicket              |
|   2   | NewTicketMessage       |
|   3   | TicketEscalated        |
|   4   | TicketActivated        |
|   5   | ActiveTickets (filter) |
|   6   | TicketTakeOver         |
|   9   | Hotlist (filter)       |
|   10  | Custom                 |

Learn more about [tickets][3].

[1]: /en/automation/crmscript/reference/CRMScript.Native.User#setvaluestringstringstring

[3]: ../request/create


## Related topics

- [Create and update customers](/en/automation/crmscript/howto/contact/create-customer.md)
- [Create and update requests](/en/automation/crmscript/howto/request/create.md)
- [Create Or Update User Candidate](/en/api/reference/restful/agent/person_agent/create-or-update-user-candidate.md)
- [Create and update companies](/en/automation/crmscript/howto/company/create-company.md)
- [Create and update messages](/en/automation/crmscript/howto/request/add-message.md)
- [SuperOffice.WebApi.Agents.PersonAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.PersonAgent.md)
