Define field
define_fieldAdd a custom field to any object that supports them (core objects with custom fields, or any custom object). field_type is one of text/number/date/select/multiselect/boolean/url, or 'relationship' (then pass target_object — stores the target record's id). select/multiselect need options. Returns the created field definition.
When to use: When an admin wants a new attribute on a core or custom object — text, number, date, choice, boolean, url, or a relationship.
Example: Add a 'square footage' number field to the Property object.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| label | Yes | Display label. Its slug (lowercase, underscores) becomes the field key, which must be unique on the object. | |
| options | No | The allowed choices for a select or multiselect field, as labels; at least one is required. Ignored for other types. | |
| field_type | Yes | The field's storage type: text, number, date, select or multiselect (pass options), boolean, url, or relationship (a link to another object; pass target_object). | |
| object_type | Yes | Object key to add the field to — a built-in object that supports custom fields, or any custom object (see describe_schema). | |
| target_object | No | For field_type relationship: the object key (built-in or custom) whose record id this field stores. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| field | No |