You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Following some posts I've seen, I am using the Python REST API to create a new issue and passing this as part of the dict of the fields:
'customfield_11585': { # 'my_field' - a cascaded selection field
'value': 'fu', # parent value: 'fu' (id=26637)
'child': {
'id': '26792' # child value: 'bar' (id=26792)
}
},
This results in error 400: "Specify a valid child option 'id' for my_field".
Next I tried to use 'name' instead of 'id' and I get a different 400 error:
"Specify a valid child option 'id' or 'name' for my_field".
Next I tried to use 'value', and I get this error:
"Specify a valid child option 'name' for my_field".
I also tried to use the option name ('bar') instead of the id, but to no avail.
The only thing that does succeed is when I pass an empty child, like this:
'customfield_11585': {
'value': 'fu',
'child': None
},
So I know that the REST API call to set the field with the parent works, but I can't set the child option.
The documentation does not provide an example of setting a cascaded field:
I think your JSON is not working properly, I made a test with automation and the Advanced editing option, which uses a Json, and I managed to update the value of the cascading field.
Here is the JSON I used: the options values and worked:
{
"fields": {
"Cascading field" : { "value": "Parent 1", "child": { "value" : "Child 1 - 2"} }
}
}
I also used ID of the child option and worked:
{
"fields": {
"Cascading field" : { "value": "Parent 1", "child": { "id" : "10160"} }
}
}
In the last image, note that I got the value from the child issue from the URL: https://xyz.atlassian.net/secure/admin/EditCustomFieldOptions!edit.jspa?fieldConfigId=10215&atl_token=0252bc82-60e3-437a-b636-f571e158a51c_f294694fe493a2305a69c4a347a3e4019a69def7_lin&selectedParentOptionId=10157&selectedValue=10160
If I test with a wrong ID, like 101600, it would give the error you are getting:
Can you check the IDs you are using and also the JSON you are using with the one that worked for me?
I hope this helps you clarify your inquiry.
Regards,
David
Oh... I forgot to say, I know your request has to do with Python, but in this case, I think the problem is regarding the JSON. Please try to double check the JSON and the options (parent and child) ids and hopefully the problem is solved.
Regards,
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you David. I tried the same code with a different cascading field and it worked.
At that point I realized that the problem was not the JSON, but the values - the values that I have specified for the "problematic" field were not aligned with the context of the field - the values I was specifying are in context A, but the project+issue type I was trying to create the issue in are in context B, which had a different set of parents and children.
Life lesson: when setting a selection field via the Jira REST API, make sure that the value (or pair of values for a cascading field) is in the context of the project and/or issue type.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Good catch, I am glad you were able to solve it !! :-)
Have a great start of the week,
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.