I’m working with JIRA 4.2 and trying to modify a custom cascading select field using Python 2.7 with suds 0.4. I need to update both the parent and child values of the field.
I found some documentation that shows how to do this with SOAPpy, but I couldn’t get it working with the Python JIRA CLI tool. For example, when I want to update a cascading field like customfield_20, I need to also update the child field customfield_20_1.
Here’s my code to check the current field values:
ticket = soap_client.service.getIssue(token, "PROJECT-12345")
for field in ticket_fields:
if field['customfieldId'] == 'customfield_20030' or field['customfieldId'] == 'customfield_20030_1':
print field
This shows me:
(RemoteCustomFieldValue){
customfieldId = "customfield_20030"
key = None
values[] =
"12345",
}
After manually setting the child value through the UI, I see:
(RemoteCustomFieldValue){
customfieldId = "customfield_20030"
key = None
values[] =
"12345",
}
(RemoteCustomFieldValue){
customfieldId = "customfield_20030"
key = "1"
values[] =
"67890",
}
I notice the key = “1” field indicates this is the child value. When I try to update it with:
soap_client.service.updateIssue(token, "PROJECT-12345", [
{"id":"customfield_20030", "values":["12345"]},
{"id":"customfield_20030_1", "key":"1", "values":["67890"]}
])
I get an error: suds.TypeNotFound: Type not found: 'key'
This happens because updateIssue expects RemoteFieldValue parameters, not RemoteCustomFieldValue parameters. How can I properly update both parent and child values of a cascading select field?
Solution that worked:
I found that using a colon to separate the parent and child field IDs works:
soap_client.service.updateIssue(token, "PROJECT-12345", [
{"id":"customfield_20030", "values":["12345"]},
{"id":"customfield_20030:1", "values":["67890"]}
])