Define field value
define_enum_valueAdmin-only add, relabel, recolor, position, archive or reorder of built-in pick-list values listed by describe_schema. An existing value_key patches only supplied label/color/position/archived fields; its key and semantic role never change. A new key needs a label and, for behavior-driving fields, a semantic_role. archived:true removes a value from new picks; stored data stays valid and archived:false restores it. Nothing is deleted. Send order alone with every value_key, including archived keys, for atomic reordering. Changes apply immediately. Returns the stored value or reordered values.
When to use: An admin changes a field's available pick-list choices.
Example: Add a 'pilot' lifecycle stage that means active_customer.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| color | No | Optional hex color for the value's chip, e.g. "#2563eb"; display only. Null clears the color; omitting it keeps an existing value's color. | |
| field | Yes | The enum field's key on that object, e.g. lifecycle_stage, type, status, priority; describe_schema lists each field's values. | |
| label | No | Display label. Required for a NEW value (its slug becomes the value_key unless value_key is set); on an existing value_key it relabels. Omit to leave a label as is. | |
| order | No | Reorder form: the field's COMPLETE value_key list in the wanted order (every current key once, archived included). Send alone with object_type + field; a partial or unknown list is refused with the current keys. | |
| archived | No | true retires an existing value from new picks (stored data keeps it, reversible); false restores it. Omit to leave the state as is; a new value is never born archived. | |
| position | No | 0-based sort position among the field's values, lower first. A new value defaults to 0; omitting it keeps an existing value's position. To set the whole order, use `order` instead. | |
| value_key | No | Stable machine key (lowercase, underscores). Defaults to the slugified label; pass an existing key to relabel, recolor, reposition, archive or restore that value. | |
| object_type | Yes | Built-in object owning the enum field, e.g. account, opportunity, subscription, touch, task, lead. | |
| semantic_role | No | Required only for a NEW value on a behavior-driving field: account.lifecycle_stage takes prospect / active_customer / at_risk / churned / dormant, opportunity.type new / post_sale, subscription.status live / inactive (a refusal names the allowed roles). Locked once the value exists; omit or null otherwise. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | ||
| order | No | ||
| values | No | ||
| updated | No | ||
| enum_value | No | ||
| current_keys | No | ||
| known_fields | No |