---
sidebar:
  hidden: true
title: roboto.domain.custom_fields.operations
---
## Module Contents

### CreateCustomFieldRequest

```python
class roboto.domain.custom_fields.operations.CreateCustomFieldRequest(/, **data: Any)
```

`from roboto.domain.custom_fields import CreateCustomFieldRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/custom_fields/operations.py#L133-L201)

Bases: `pydantic.BaseModel`

Request body for [`create()`](/docs/reference/python-sdk/roboto/domain/custom_fields/custom_field#roboto.domain.custom_fields.custom_field.CustomField.create).

A reserved `field_name` raises `RobotoInvalidRequestException`. A `metadata_path` other than `None` raises `RobotoInvalidRequestException`. Building it raises `pydantic.ValidationError` when:

- `description` is over 256 characters.
- `display_name` is over 128 characters.
- `field_name` does not match its pattern.
- `options` declares an enum value that `options` rejects.
- `options` do not suit `field_type`.

**Parameters**

- **data** (`Any`)

**Attributes**

- **CreateCustomFieldRequest.description** (`FieldDescription | None`) = `None`: Human-readable description of the custom field, at most 256 characters.

  Surrounding whitespace is stripped, and text that is blank once stripped sets no description, as `None` does.

- **CreateCustomFieldRequest.display_name** (`FieldDisplayName | None`) = `None`: Human-readable label for the custom field, shown in the Roboto web app, at most 128 characters.

  Surrounding whitespace is stripped, and text that is blank once stripped sets no label, as `None` does.

- **CreateCustomFieldRequest.entity_type** (`roboto.domain.custom_fields.record.TargetEntityType`): Entity type the custom field extends.

- **CreateCustomFieldRequest.field_name** (`Annotated[str, pydantic.StringConstraints(pattern=f'^{CUSTOM_FIELD_NAME_PATTERN}$')]`): Name of the custom field, unique within its organization and entity type, and fixed once the field is created.

  Must match `^[a-z][a-z0-9_]{0,62}$`: a lowercase ASCII letter, then up to 62 lowercase ASCII letters, digits, or underscores. Roboto reserves a few names that match it.

- **CreateCustomFieldRequest.field_type** (`roboto.domain.custom_fields.record.CustomFieldType`): Value type of the custom field, fixed once the field is created.

  It determines which operators search and sort support on the field.

- **CreateCustomFieldRequest.metadata_path** (`str | None`) = `None`: Reserved for promoting a metadata key to a custom field. Leave it `None`.

- **CreateCustomFieldRequest.options** (`ValidatedCustomFieldOptions | None`) = `None`: Type-specific configuration of the custom field. Required for an enum field, to declare its allowed values.

  Each enum value is normalized before it is stored: composed to Unicode NFC, with surrounding whitespace stripped and each run of internal whitespace collapsed to a single space. A value that repeats an earlier one once normalized is dropped, so the values keep the order in which each first appears. A field may declare at most 250 distinct values, each at most 256 characters as supplied, not counting surrounding whitespace.

  A value is rejected if it is blank, or if it contains a control character, a double quote, or a backslash, because search could not reliably match such a value.

#### CreateCustomFieldRequest.check_options_match_field_type()

```python
def check_options_match_field_type() -> CreateCustomFieldRequest
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/custom_fields/operations.py#L195-L201)

Reject an enum field without `options`, and `options` for a different field type.

Pydantic calls this while it builds the request.

**Returns**

- `CreateCustomFieldRequest`

### FieldDescription

```python
type roboto.domain.custom_fields.operations.FieldDescription = Annotated[str, pydantic.StringConstraints(max_length=256)]
```

`from roboto.domain.custom_fields.operations import FieldDescription`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/custom_fields/operations.py#L26-L26)

Human-readable description of a custom field, at most 256 characters.

### FieldDisplayName

```python
type roboto.domain.custom_fields.operations.FieldDisplayName = Annotated[str, pydantic.StringConstraints(max_length=128)]
```

`from roboto.domain.custom_fields.operations import FieldDisplayName`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/custom_fields/operations.py#L29-L29)

Human-readable label for a custom field, at most 128 characters.

### ListCustomFieldsRequest

```python
class roboto.domain.custom_fields.operations.ListCustomFieldsRequest(/, **data: Any)
```

`from roboto.domain.custom_fields import ListCustomFieldsRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/custom_fields/operations.py#L205-L218)

Bases: `pydantic.BaseModel`

Request body for [`list()`](/docs/reference/python-sdk/roboto/domain/custom_fields/custom_field#roboto.domain.custom_fields.custom_field.CustomField.list).

Building the request raises `pydantic.ValidationError` when `statuses` is empty.

**Parameters**

- **data** (`Any`)

**Attributes**

- **ListCustomFieldsRequest.entity_type** (`roboto.domain.custom_fields.record.TargetEntityType | None`) = `None`: Entity type to list custom fields for. `None` lists the fields on every entity type.
- **ListCustomFieldsRequest.page_token** (`str | None`) = `None`: Token from a previous page's response that resumes the listing after it. `None` starts at the first page.
- **ListCustomFieldsRequest.statuses** (`list[roboto.domain.custom_fields.record.CustomFieldStatus]`) = `None`: Statuses of the custom fields to list. Must hold at least one.

### UpdateCustomFieldRequest

```python
class roboto.domain.custom_fields.operations.UpdateCustomFieldRequest(/, **data: Any)
```

`from roboto.domain.custom_fields import UpdateCustomFieldRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/custom_fields/operations.py#L222-L269)

Bases: `pydantic.BaseModel`

Request body for [`update()`](/docs/reference/python-sdk/roboto/domain/custom_fields/custom_field#roboto.domain.custom_fields.custom_field.CustomField.update).

A field left unset (`NotSet`) is unchanged.

A request for a custom field whose status is not [`Ready`](/docs/reference/python-sdk/roboto/domain/custom_fields/record#roboto.domain.custom_fields.record.CustomFieldStatus.Ready) raises `RobotoInvalidRequestException`. `options` for a different field type, or without an enum value the field already has, raise `RobotoInvalidRequestException`. Building it raises `pydantic.ValidationError` when:

- `description` is over 256 characters.
- `display_name` is over 128 characters.
- `options` declares an enum value that `options` rejects.

**Parameters**

- **data** (`Any`)

**Attributes**

- **UpdateCustomFieldRequest.description** (`FieldDescription | None | roboto.sentinels.NotSetType`): Human-readable description of the custom field, at most 256 characters. `None` clears it.

  Surrounding whitespace is stripped, and text that is blank once stripped clears it too.

- **UpdateCustomFieldRequest.display_name** (`FieldDisplayName | None | roboto.sentinels.NotSetType`): Human-readable label for the custom field, shown in the Roboto web app, at most 128 characters.

  `None` clears it. Surrounding whitespace is stripped, and text that is blank once stripped clears it too.

- **UpdateCustomFieldRequest.model_config**: Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

- **UpdateCustomFieldRequest.options** (`ValidatedCustomFieldOptions | roboto.sentinels.NotSetType`): Type-specific configuration to replace the custom field's own.

  Must be for the field's `field_type`. For an enum field, `enum_values` must include every value the field already has: values can be added but not removed.

  Enum values are normalized and capped as `CreateCustomFieldRequest.options` describes. A value that repeats an earlier one once normalized is dropped rather than rejected, so re-sending a value the field already has changes nothing.

### ValidatedCustomFieldOptions

```python
type roboto.domain.custom_fields.operations.ValidatedCustomFieldOptions = Annotated[CustomFieldOptions, pydantic.AfterValidator(_validate_field_options)]
```

`from roboto.domain.custom_fields.operations import ValidatedCustomFieldOptions`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/custom_fields/operations.py#L102-L102)

Type-specific configuration of a custom field, as a create or update request carries it.

Building the request normalizes the enum values and rejects any it cannot store, as `CreateCustomFieldRequest.options` describes.

### check_options_match_field_type()

```python
def roboto.domain.custom_fields.operations.check_options_match_field_type(
    field_type: roboto.domain.custom_fields.record.CustomFieldType,
    options: Optional[roboto.domain.custom_fields.record.CustomFieldOptions],
) -> None
```

`from roboto.domain.custom_fields.operations import check_options_match_field_type`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/custom_fields/operations.py#L110-L129)

Reject an enum field type without `options`, and `options` for a different field type.

[`create()`](/docs/reference/python-sdk/roboto/domain/custom_fields/custom_field#roboto.domain.custom_fields.custom_field.CustomField.create) and [`update()`](/docs/reference/python-sdk/roboto/domain/custom_fields/custom_field#roboto.domain.custom_fields.custom_field.CustomField.update) check a field's options through it, so most code never calls it.

**Parameters**

- **field_type** (`roboto.domain.custom_fields.record.CustomFieldType`): Value type of the custom field.
- **options** (`Optional[roboto.domain.custom_fields.record.CustomFieldOptions]`): Type-specific configuration for the field, or `None` if it has none.

**Raises**

- `ValueError`: `field_type` is [`Enum`](/docs/reference/python-sdk/roboto/domain/custom_fields/record#roboto.domain.custom_fields.record.CustomFieldType.Enum) and `options` is `None`, or `options` are for a different field type.

**Returns**

- `None`
