go-jira / jira

simple jira command line client in Go
Apache License 2.0
2.66k stars 323 forks source link

Unable To Edit: Could not find valid 'id' or 'value' in the Parent Option object. #464

Closed codeorganic closed 2 years ago

codeorganic commented 2 years ago

I am unable to edit a jira ticket with a customfield, please let me know if you have additional questions.

Error Response

ERROR customfield_21900: Could not find valid 'id' or 'value' in the Parent Option object.

Command jira edit <Ticket> --override teamName="TEMP" --noedit -v

Template I have tried many ways with the template. Including using - id: but always results with the same error

  {{- if and .meta.fields.customfield_21900 .overrides.teamName }}
    customfield_21900:
      - value: "TEMP"{{end}}

EditMedia Abstract taken from jira editmedia

        "customfield_21900": {
            "allowedValues": [
                {
                    "disabled": false,
                    "id": "41301",
                    "self": "https://<JIRA CORP>/rest/api/2/customFieldOption/91301",
                    "value": "TEMP"
                },
                ..................
            ],
            "name": "Team",
            "operations": [
                "set"
            ],
            "required": true,
            "schema": {
                "custom": "com.atlassian.jira.plugin.system.customfieldtypes:select",
                "customId": 21900,
                "type": "option"
            }
        },

When using -v I can clearly see the API request/response

API Request {"fields":{"customfield_21900":[{"value":"TEMP"}]}} API Response {"errorMessages":[],"errors":{"customfield_21900":"Could not find valid 'id' or 'value' in the Parent Option object."}}

codeorganic commented 2 years ago

Solved.

{"fields":{"customfield_21900":{"value":"TEMP"}}}