> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/documentation/use-octoxlabs/settings/data-source-settings/custom-adapter-settings.md).

# Custom Adapter Settings

Add your own fields to assets, give them values by hand or from CSV files, and turn on the custom adapter so the values are applied after every discovery.

**Custom Adapter Settings** lets you keep data that no adapter collects, such as an owner, a cost centre or a flag, on your devices. You define a custom field once, then give it a value for each hostname. OctoXLabs adds those values to the matching devices as data from a built-in source called custom data, so you can show them in the Device Inventory and filter on them in queries.

You can set values in three ways: one device at a time, in bulk from the Device Inventory, or by uploading a CSV file. To set a value for every device that matches a condition instead of naming hostnames, use data rules. See Data Rules. This page is not about file-based adapters, which read whole asset lists from files on a connector server. For those, see File-based adapters.

### Before you begin

* Applies to: OctoXLabs 6.x. Data rules need 6.3.0 or later.
* Required permission to open the page: `customs.view_data`.
* Required permissions for fields: `customs.add_data` (the **Create Custom Data Field** button), `customs.change_data` and `customs.delete_data`. Saving the form itself checks `customs.add_field` or `customs.change_field`, so give a group both sets.
* Required permissions for the **Upload** menu: `customs.upload_custom_data_file`, `customs.upload_custom_fields_file` and `customs.upload_custom_data_rule_file`, one per upload type.
* These permissions can be given to custom groups.

{% hint style="warning" %}
Turn on **Enable Custom Adapter** under **Settings** > **Product Settings** > **Advanced Settings** (**Advanced** tab). It is off by default. While it is off, discoveries do not add custom data to devices and do not re-apply data rules. See Advanced Settings.
{% endhint %}

### Open the page

Go to **Settings** > **Data Source Settings** > **Custom Adapter Settings**. The table lists your custom fields, with a search box above it.

| Column           | What it shows                                             |
| ---------------- | --------------------------------------------------------- |
| **Field Name**   | The name of the custom field.                             |
| **Field Type**   | `char`, `int` or `bool`.                                  |
| **Default Data** | The value used for a device that has no value of its own. |

### Custom field settings

| Setting     | Type                                            | Default  | Description                                                                                                                    |
| ----------- | ----------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------ |
| **Name**    | Text, up to 255 characters                      | Empty    | Required. Letters, hyphens and underscores only. No digits, spaces or other characters. Names are case sensitive in CSV files. |
| **Type**    | Selection: **Text**, **Number**, **Boolean**    | **Text** | The type of every value of this field. **Text** is stored as `char`, **Number** as `int`, **Boolean** as `bool`.               |
| **Default** | Text, number or checkbox, depending on **Type** | Empty    | Optional. The value used when a device has no value for this field.                                                            |

### Create a custom field

{% stepper %}
{% step %}

#### Open the form

On the **Custom Adapter Settings** page, select **Create Custom Data Field**.
{% endstep %}

{% step %}

#### Define the field

Enter a **Name**, choose the **Type** and, if you want one, set the **Default**.
{% endstep %}

{% step %}

#### Save

Select **Create**. The console shows **Custom data has been created**. Editing a field later shows **Custom data has been saved**.
{% endstep %}
{% endstepper %}

When you create a field and a discovery already exists, OctoXLabs also refreshes the device data so the default shows up.

### Give a field values

* **One device.** Open the device in the Device Inventory and, in its custom data section (**Detail View** or **Data Table**), use the form titled **Add Custom Data**. The table shows **Field Name**, **Type**, **Data**, **Default Data** and **Updated By**.
* **Many devices.** In the Device Inventory list, open the bulk update dialog, titled **Update Custom Field**. Pick the **Field Name**, enter a **Value** and apply it to the devices you selected.
* **From a file.** Use **Upload** > **Upload Initial Data** (see below).
* **By condition.** Create a data rule. Open a field with the edit action, then use **Create Data Rule**. See Data Rules.

### Upload CSV files

Select **Upload** on the **Custom Adapter Settings** page and choose one of the options. Every upload must be a `.csv` file encoded in UTF-8. Large files are uploaded in parts and processed in the background. The page shows the progress.

| Upload option             | Required header row                                                       | What it does                                                                                                                                                                     |
| ------------------------- | ------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Upload Fields**         | `name, field_type, default`                                               | Creates many custom fields at once. `field_type` must be `char`, `int` or `bool`. Field names are case sensitive. The success message is **CSV file uploaded**.                  |
| **Upload Initial Data**   | `field, hostname, value`                                                  | Sets a value for a hostname on an existing field. If the hostname already has a value for that field, it is replaced. The success message is **Initial data has been uploaded**. |
| **Upload Data Rule File** | First column is the search field, followed by one column per custom field | Creates data rules in bulk. Covered in Data Rules.                                                                                                                               |

```
field,hostname,value
Owner,srv-app-01,IT Operations
Owner,wks-0042,Finance
```

The `field` column must name a field that already exists. If it does not, the upload fails with `Incorrect field name(s) in CSV file`, followed by the missing names.

### Edit or delete a field

Use the edit action on a row to change the **Name**, **Type** or **Default**, or to manage its data rules. The delete action removes the field and shows **Custom adapter named has been deleted.**

### Troubleshooting

| Symptom or error message                          | Cause                                                                                          | Fix                                                                     |
| ------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| `There cannot be bad char in the field name`      | The **Name** contains a digit, space or a character other than letters, hyphen and underscore. | Rename the field, for example `Cost_Centre` instead of `Cost Centre 2`. |
| `You must upload CSV file`                        | The file does not end in `.csv`.                                                               | Save the file as CSV.                                                   |
| `CSV file must be UTF-8 encoded.`                 | The file uses another encoding.                                                                | Save the file as UTF-8.                                                 |
| `CSV headers must be: name, field_type, default.` | The header row of a fields file is wrong.                                                      | Use exactly those three headers.                                        |
| `CSV headers must be: field, hostname, value.`    | The header row of an initial data file is wrong.                                               | Use exactly those three headers.                                        |
| `Hostname and Field must be unique`               | A value for this hostname and field already exists.                                            | Edit the existing value instead of adding a new one.                    |
| Values do not appear on devices after a discovery | **Enable Custom Adapter** is off.                                                              | Turn it on in **Advanced Settings** and run a discovery.                |

### What's next?

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Data Rules</strong></td><td>Assign a custom value to every device that matches a condition.</td><td></td></tr><tr><td><strong>File-based adapters</strong></td><td>Bring whole asset lists in from CSV, XLSX, JSON or XML files.</td><td></td></tr><tr><td><strong>Advanced Settings</strong></td><td>Turn on Enable Custom Adapter.</td><td></td></tr></tbody></table>
