# CMDB field types in OTOBO

> Reference, lens, and General Catalog fields for OTOBO configuration items, and how sections place them on the zoom page.

- HTML: https://otobo-docs.softoft.de/en/other/cmdb/field-types/
- Markdown: https://otobo-docs.softoft.de/en/other/cmdb/field-types.md

Every attribute on a configuration item is a **dynamic field** of object type **ITSM ConfigItem**. The [config item definition](https://otobo-docs.softoft.de/en/other/cmdb/ci-yaml/) only places fields that already exist. Create the field, then refer to it with `DF:`.

![Schematic zoom page: a Summary tab with name, owner, and location, and a Description area beside it.](../../../../../assets/cmdb/cmdb-yaml-layout.jpg)

_Schematic only. Pages and sections in the class definition produce this kind of zoom layout._

## Reference field

A reference field stores a pointer, not a copy.

```mermaid
flowchart LR
  Workplace["Workplace PC-14"] -->|ConfigItem reference| Room["Room: Support"]
  Workplace -->|Agent reference| Agent["Agent: owner"]
  Workplace -->|Customer User reference| User["Customer user"]
  Room -->|ConfigItem reference| Building["Building"]
```

| Target            | Use it for                                 | Side effect                                        |
| ----------------- | ------------------------------------------ | -------------------------------------------------- |
| Agent             | The responsible agent                      | —                                                  |
| ConfigItem        | Another asset, including a place hierarchy | Feeds links and the tree of dependencies           |
| ConfigItemVersion | One historic version of another item       | Pins an exact state                                |
| Customer          | The company or department                  | Item shows in the Customer Information Center      |
| Customer User     | The person who uses the asset              | Item shows in the Customer User Information Center |

The same idea is how you build Country → Site → Building → Room without a separate drawing tool. Each step is a ConfigItem reference. Read that chain on [relations and impact](https://otobo-docs.softoft.de/en/other/cmdb/relations-and-impact/).

## Lens field

A **lens field** reads one attribute through a reference, like a periscope.

```mermaid
flowchart LR
  App["Billing app"] -->|reference field| Server["srv-db-01"]
  Server --> IP["IP address"]
  Server --> Owner["Server owner"]
  App --> LensIP["Lens: IP address"]
  App --> LensOwner["Lens: server owner"]
  LensIP -.-> IP
  LensOwner -.-> Owner
```

Set three things on the lens:

1. **Referenced DF** — the reference field that points at the other item.
2. **Attribute DF of the referenced object** — the value to show, such as the IP address.
3. **Readonly: 1** when this screen must not edit the other item.

A lens is right for "show me the server's IP while I look at the application". It is wrong for a value this item owns. Owned values are normal fields.

## General Catalog field

A General Catalog field is a dropdown whose options live under **Admin → General Catalog**, not inside one dynamic field. Two classes can share one catalog. Change the catalog once and both dropdowns follow.

Use it for short, stable lists: lifecycle state, environment (production, test), or vendor. Use a normal dropdown only when the list belongs to a single class and will not be reused.

Free text is the wrong tool for either list. Agents will type `Prod`, `prod`, and `production`, and filters will miss two of them.

## Section types on the zoom page

The config item definition does not only list fields. Each section has a type.

| Type              | What the agent sees                                                                                                                                                                |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| DynamicFields     | The default. A header, fields, and optional grids. `Mandatory: 1` forces a value. `Readonly: 1` blocks editing. `Label` renames the field on this mask.                            |
| Description       | A rich-text block, including images, edited on the item.                                                                                                                           |
| ConfigItemLinks   | Items linked to this one. `LinkedAs` is Source, Target, or Both. `LinkTypes` limits which link types appear. Not an edit mask.                                                     |
| ReferencedSection | Embeds a section of the item named in `ReferenceField`. `SectionName` picks the section. `FieldListPre` and `FieldListPost` add fields of _this_ item around it. Not an edit mask. |

A two-column summary looks like this:

```yaml
Pages:
  - Name: Summary
    Layout:
      Columns: 2
      ColumnWidth: 1fr 1fr
    Interfaces:
      - Agent
    Content:
      - Section: Server::Summary
        RowStart: 1
        ColumnStart: 1
      - Section: Server::Description
        RowStart: 1
        ColumnStart: 2

Sections:
  Server::Summary:
    Content:
      - Header: Summary
      - DF: Server-Name
        Mandatory: 1
      - DF: Server-Owner
      - DF: Server-Room
  Server::Description:
    Type: Description
```

`Interfaces` can include `Customer` when that page should appear in the customer frontend. `Groups` hides a page, such as accounting, from agents who are not in that group.

Roles reuse a section across classes. The definition names the role, and pages refer to `RoleName::SectionName`. The [YAML modeling](https://otobo-docs.softoft.de/en/other/cmdb/ci-yaml/) chapter goes through pages, grids, and roles in more detail.

## Calculated values

OTOBO 11 also documents formula and script fields for values derived from other attributes, such as a total built from count and size. Keep the formula next to the source fields on the same page, and treat the result as read-only. The patterns already used in this guide are on [import and export](https://otobo-docs.softoft.de/en/other/cmdb/import-export-cmdb/). Do not invent a second stored copy of a calculated number.

## Frequently asked questions

### Which reference field targets does the OTOBO CMDB support?

Fields on a configuration item class are dynamic fields of object type ITSM ConfigItem. A reference field points at another OTOBO object instead of storing a copied value.

The useful targets are Agent (the person responsible), ConfigItem (another asset, for a hierarchy such as country, site, building, room), ConfigItemVersion (one stored version of another item), Customer (the company, which also shows the item in the Customer Information Center), and Customer User (the owner, which shows the item in the Customer User Information Center).

Create the dynamic field first, then name it in the config item definition with a DF entry. A field that is not referenced in the definition does not appear on the zoom page.

- [Dynamic field specifics](https://doc.otobo.org/manual/packages/itsmconfigurationmanagement/11.0/en/content/configuration/custom_configuration_and_advanced_features/dynamic_fields_specifics.html)
- [Config item definitions](https://doc.otobo.org/manual/packages/itsmconfigurationmanagement/11.0/en/content/configuration/custom_configuration_and_advanced_features/config_item_definitions.html)

### What does a lens field show, and when should it be read-only?

A lens field looks through a reference and shows one attribute of the referenced object. If a workplace references a server, a lens can show that server's IP address or owner on the workplace zoom without copying the value into the workplace.

The lens needs two settings: the dynamic field that holds the reference, and the attribute on the referenced object to display. Set the lens to read-only when agents must not change the referenced item from this screen. The definition accepts Readonly set to 1 on basic fields.

Use a lens for context. Use a real attribute when this item owns the value. A copied IP address goes stale the day the server changes.

- [Dynamic field specifics](https://doc.otobo.org/manual/packages/itsmconfigurationmanagement/11.0/en/content/configuration/custom_configuration_and_advanced_features/dynamic_fields_specifics.html)
- [OTOBO CMDB overview](https://doc.otobo.org/manual/packages/itsmconfigurationmanagement/11.0/en/content/overview.html)
