# \_setCustomerTypes

### Parameters

#### id

The id of the edited Department

#### val

An array with the IDs of the chosen Customer Types

### Example

```
FM_api(
    'Department_setCustomerTypes',[
        'id' => '337119',
        'val' => json_encode(['60020','60021'])
    ]
);
```

### Results

#### On Success

```
{"ok":1}
```

#### On Failure

If no 'id' parameter value is given

```
{"error":"no id supplied"}
```

If no 'val' parameter value is given

```
{"error":"no val supplied"}
```

If the 'val' parameter is not in the correct format

```
{"error":"val should be a JSON-encoded array of intergers"}
```

If there is no Department matching the given 'id'

```
{"error":"department does not exist"}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fieldmotion.com/fieldmotion-api-docs/department/_setcustomertypes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
