Skip to content

Custom fields feature only works with Enum types #638

@ryancheley

Description

@ryancheley

Problem

The custom fields feature (--custom-field) added in v0.22.0 has a critical limitation: it assumes all custom fields are Enum types and fails with type mismatch errors for other field types like Simple, Text, User, Version, etc.

When users specify custom fields via --custom-field "FieldName=value", the CLI formats all fields as SingleEnumIssueCustomField with EnumBundleElement values, regardless of the actual field type in YouTrack.

Root Cause

Code locations:

  • services/issues.py line 84 (create_issue)
  • services/issues.py line 252 (update_issue)

Both locations hardcode:

CustomFieldManager.create_single_enum_field(field_name, field_value)

Example Failure

Command:

yt issues update DEMO-20 --custom-field "dumb=test-value"

Expected behavior: SimpleIssueCustomField with SimpleIssueCustomFieldValue
Actual behavior: SingleEnumIssueCustomField with EnumBundleElement
Result: YouTrack API returns 400 error - type mismatch

Impact

Currently works: Enum-type fields (Priority, Type)
Currently fails: Simple, Text, User, Version, and other non-enum field types

Solution Required

The CLI needs to support all custom field types, not just enums. Options:

  1. Query project custom field definitions to detect field types before sending to API
  2. Implement formatters for all field types (Simple, User, Version, etc.)
  3. Add intelligent type detection with fallback logic
  4. Document the limitation if not fixing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions