
# fob-mdm fields

Fields are an object's attributes, such as Name or GSTIN. A field's key can't change, and a field is retired rather than deleted. Commands that change one field take its id, shown by `fields list`.

```
fob-mdm fields <action> [target] [options]
```

| Action | Description |
|---|---|
| [`list`](#fields-list) | List an object's fields in display order |
| [`show`](#fields-show) | Show one field |
| [`create`](#fields-create) | Add a field to an object |
| [`edit`](#fields-edit) | Change a field's label, type or settings (the key can't change) |
| [`delete`](#fields-delete) | Retire a field: it keeps its values and history but takes no new values |

## fields list

List an object's fields in display order.

```
fob-mdm fields list --object <object> [options]
```

| Argument or option | Required | Default | Description |
|---|---|---|---|
| `--object <object>` | Yes |  | Object id or slug. |
| `--include-retired` |  |  | Include retired fields. |
| `--page <n>` |  | `1` | Page number. |
| `--limit <n>` |  | `100` | Rows per page (max 500). |
| `--all` |  |  | Fetch every page (up to 15000 rows). |
| `--json` |  |  | Print the raw JSON response. |

```bash
fob-mdm fields list --object vendor
fob-mdm fields list --object vendor --include-retired
```

```
ID  KEY        LABEL      TYPE  REQUIRED  IDENTITY  RETIRED
-----------------------------------------------------------
10  name       Name       text  yes       —         —
11  gstin      GSTIN      text  —         yes       —
12  bank_ifsc  Bank IFSC  text  —         —         —
```

API: [List Fields](/docs/api/endpoints/fields/list)

## fields show

Show one field.

```
fob-mdm fields show <id> [options]
```

| Argument or option | Required | Default | Description |
|---|---|---|---|
| `<id>` | Yes |  | Field id. |
| `--json` |  |  | Print the raw JSON response. |

```bash
fob-mdm fields show 12
```

API: [Get Field](/docs/api/endpoints/fields/get)

## fields create

Add a field to an object.

```
fob-mdm fields create --object <object> --key <key> --label <label> [options]
```

| Argument or option | Required | Default | Description |
|---|---|---|---|
| `--object <object>` | Yes |  | Object id or slug. |
| `--key <key>` | Yes |  | Machine name, e.g. bank_ifsc. Can't be changed later. |
| `--label <label>` | Yes |  | Display name, e.g. Bank IFSC. |
| `--type <type>` |  | `text` | Field type. One of `text`, `number`, `date`, `boolean`. |
| `--required` |  |  | Every record should have it. |
| `--identity` |  |  | Identifies the same entity across apps, e.g. GSTIN. |
| `--json` |  |  | Print the raw JSON response. |

```bash
fob-mdm fields create --object vendor --key name --label Name --required
fob-mdm fields create --object vendor --key gstin --label GSTIN --identity
fob-mdm fields create --object vendor --key bank_ifsc --label 'Bank IFSC'
```

The identity field is how an app's records are matched to golden records when an integration pulls, so mark one field per object. Pulling fails until the object has one.

API: [Create Field](/docs/api/endpoints/fields/create)

## fields edit

Change a field's label, type or settings (the key can't change).

```
fob-mdm fields edit <id> [options]
```

| Argument or option | Required | Default | Description |
|---|---|---|---|
| `<id>` | Yes |  | Field id. |
| `--label <label>` |  |  | Display name. |
| `--type <type>` |  |  | Field type. One of `text`, `number`, `date`, `boolean`. |
| `--required` |  |  | Mark as required. |
| `--no-required` |  |  | Mark as optional. |
| `--identity` |  |  | Mark as the identity field. |
| `--no-identity` |  |  | Unmark as the identity field. |
| `--json` |  |  | Print the raw JSON response. |

```bash
fob-mdm fields edit 12 --label 'Bank IFSC code'
fob-mdm fields edit 12 --required
```

API: [Update Field](/docs/api/endpoints/fields/update)

## fields delete

Retire a field: it keeps its values and history but takes no new values.

```
fob-mdm fields delete <id> [options]
```

| Argument or option | Required | Default | Description |
|---|---|---|---|
| `<id>` | Yes |  | Field id. |
| `-y, --yes` |  |  | Skip the confirmation. |

```bash
fob-mdm fields delete 12 --yes
```

Retires the field. Its values and history stay, but it takes no new values: setting it answers `FIELD_RETIRED`.

API: [Retire Field](/docs/api/endpoints/fields/delete)

Every command also takes `--profile <name>` and `--help`. See [Command-line Interface](/docs/cli).
