Skip to content

feat(custom-fields): Add support for CMDB object fields#937

Draft
RoderickJDunn wants to merge 1 commit intoankitpokhrel:mainfrom
RoderickJDunn:feat/cmdb-object-field-support
Draft

feat(custom-fields): Add support for CMDB object fields#937
RoderickJDunn wants to merge 1 commit intoankitpokhrel:mainfrom
RoderickJDunn:feat/cmdb-object-field-support

Conversation

@RoderickJDunn
Copy link
Copy Markdown

Summary

  • Adds support for CMDB (Assets/Insight) object custom fields which require JSON array
    format
  • Previously, CMDB field values were passed as escaped strings, causing expected Object
    errors from the Jira API
  • Handles CMDB fields in both create and edit operations

Problem

When creating/editing issues with CMDB object fields:

jira issue create --custom cycle='[{"workspaceId":"...","objectId":"24"}]' -s "Test"

The CLI would send the value as an escaped string instead of a parsed JSON object:
{"customfield_15259": "[{"workspaceId":"..."}]"} // Wrong - escaped string
{"customfield_15259": [{"workspaceId":"..."}]} // Correct - JSON array

Changes

  1. pkg/jira/customfield.go - Added customFieldFormatCMDBObject constant
  2. pkg/jira/create.go - Handle CMDB fields in constructCustomFields()
  3. pkg/jira/edit.go - Handle CMDB fields in constructCustomFieldsForEdit()

Test plan

  • make ci passes (lint + tests)
  • Manually tested in production Jira instance

CMDB (Assets/Insight) object fields require JSON array format with
workspaceId, id, and objectId properties. Previously, the CLI passed
these values as escaped strings, causing "expected Object" errors.

This change:
- Adds customFieldFormatCMDBObject constant for "cmdb-object-field" type
- Parses JSON input for CMDB fields in constructCustomFields()
- Handles CMDB fields in constructCustomFieldsForEdit() with proper
  "set" semantics for edit operations

Usage:
  jira issue create --custom cycle='[{"workspaceId":"...","objectId":"24"}]'

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant