Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

What is the syntax for using the JIRA REST API to update a cascading select field?

David Mahoney October 24, 2012

I'm just trying to write a simple script to update a JIRA via the REST API. The field I want to update is a custom cascading select field.

I'm working from this tutorial:

https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+Edit+issues

Here is the command I'm executing:

curl --insecure -D- -u <username>:<password> -X PUT --data @input.dat -H "Content-Type: application/json" "https://<ourURL>/rest/api/2/issue/IPCLIENTS-12043"

and here is the content of input.dat:

{
    "update" : {
        "customfield_11272" : [{"set" : {"value" : "External Customer (Worst)"}}],
        "customfield_11272:1" : [{"set" : {"value" : "Production"}}]
    }
}

where customfield_11272 is the name of the parent, and customfield_11272:1 is the name of the child in the cascading select field

I keep getting the message:

{"errorMessages":[],"errors":{"customfield_11272_1":"Field 'customfield_11272_1' cannot be set. It is not on the appropriate screen, or unknown."}}

I also tried using the "fields" function instead of "update", but got the same error, as did using customfield_11272_1

So, obviously, I am not going about this properly. If I delete the second line, it updates the top level fine. What is the proper syntax for updating the second level of the field?

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

5 votes
Answer accepted
David Mahoney October 25, 2012

Nevermind... it was documented, more or less, in the Create Issue part of the tutorial:

{
    "update" : {
        "customfield_11272" : [{"set" : {"value" : "External Customer (Worst)","child": {"value":"Production"}}}]
    }
}

Nagaveer December 11, 2013

I'm getting problem in updating cascading field...

Can you share your code?, Please.,

Virginia Bolyard December 12, 2013

The code is as above. That is the content of the input.dat file for use with the curl command in my original post. It updates cascading select field "customfield_11272" with top level "External Customer (Worst)" and second level "Production". Alternately, you could put all of it on one line, surround it with single quotes, and put it after --data.

David Mahoney December 12, 2013

The code is as above. That is the content of the input.dat file for use with the curl command in my original post. It updates cascading select field "customfield_11272" with top level "External Customer (Worst)" and second level "Production". Alternately, you could put all of it on one line, surround it with single quotes, and put it after --data

Emil Vakhitov October 24, 2017

Thank you!

I would also add that almost the same pattern works with issue transitions if there are cascadingselect fields that need to be filled to do a transition.

With but one small change:

"customfield_11272" : {"value" : "External Customer (Worst)","child": {"value":"Production"}}

 instead of

"customfield_11272" : [{"set" : {"value" : "External Customer (Worst)","child": {"value":"Production"}}}]

 

1 vote
Ramakrishnan Srinivasan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 25, 2019

Hi, This has worked for me; I am using python jira rest module; 

from jira import JIRA
import re

options = {
'server': 'https://jirahost.com/jira/',
'verify': False }
jira = JIRA(options, basic_auth=('userid', 'password'))

issue = jira.issue('PROJ-1')

issue.update(fields={'summary' : 'Re-assigned to John Doe' \
,'assignee': {'name':'johnd'} \
, "customfield_14510":{"value" : "Dec-18", "child": {"value":"25%"}} \
, "customfield_14511":{"value" : "Jan-19", "child": {"value":"75%"}} \
})
TAGS
AUG Leaders

Atlassian Community Events