grokify / gojira

Jira client with REST functionality built on go-jira and XML parsing support
https://pkg.go.dev/github.com/grokify/gojira
MIT License
0 stars 0 forks source link

Cannot update issue custom field "Select List (cascading)" with string value. #61

Closed grokify closed 2 months ago

grokify commented 2 months ago

Received the following when attempting to use the following with a custom field of type Select List (cascading) with IssueAPI.IssuePatch().

Request

Using cURL:

curl -XPUT -u <un:pw> -H 'Content-Type: application/json' -d '{"fields":{"customfield_12479":"Named Value"}}' 'https://saviyntars.atlassian.net/rest/api/3/issue/FOO-123'

Response

{
  "errorMessages": [],
  "errors": {
    "customfield_12345": "Can not instantiate value of type [simple type, class com.atlassian.jira.issue.fields.rest.json.beans.CustomFieldOptionJsonBean] from JSON String; no single-String constructor/factory method"
  }
}
grokify commented 2 months ago

Info here on CustomFieldOptionJsonBean:

  1. https://community.atlassian.com/t5/Jira-Service-Management/How-to-set-value-for-single-select-custom-field-with-REST-API/qaq-p/2393402
  2. https://community.atlassian.com/t5/Jira-questions/Update-a-Two-Part-Custom-Field-in-Jira-with-Python/qaq-p/722015
{
  "customfield_12345": {
    "value": "value"
  }
}
{
  "customfield_12345": {
    "value": "parentVal",
    "child": {
      "value": "childVal"
    }
  }
}
grokify commented 2 months ago

For a field like:

  1. UI Value: "Child Value"
  2. UI Select: "Child Value - Parent Value"

Set via:

{
  "customfield_12345": {
    "value": "Child Value"
  }
}

Supported in 93cffc510ec12e8bd36c707be31c4c48ccf713de