> For the complete documentation index, see [llms.txt](https://docs.fieldmotion.com/fieldmotion-api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fieldmotion.com/fieldmotion-api-docs/user/_setdepartments.md).

# \_setDepartments

Assign Departments to a user.

### Parameters

#### id

The ID of the User.

#### vals

The IDs of User Departments you wish to set for the User.

### Example

```
FM_api('User_setDepartments', ['id' => '123', 'vals' => '1, 2, 3']);
```

### Result

#### On Success

```
{'ok':1}
```
