Modifying JIRA cascading dropdown custom field using Python suds library

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"]}
])

nice find with the colon syntax! hit this same issue last year and wasted hours trying different approaches. jira’s soap api docs are pretty awful for cascading fields. just validate the child values exist under that parent first - otherwise you’ll get cryptic errors down the line.

Indeed, the colon syntax is essential for this. I faced similar issues while transitioning from SOAPpy to suds for JIRA. It’s crucial to ensure that the parent value is set before the child value in your field array; otherwise, JIRA will throw an error. Stick with the actual option IDs rather than display names. Those numeric values you’re using (12345, 67890) seem correct. For troubleshooting cascading fields, consider enabling SOAP logging in suds to monitor the outgoing requests. I also had confusion regarding the distinction between RemoteFieldValue and RemoteCustomFieldValue initially.

Had the same issues migrating from older JIRA versions. Colon notation works, but here’s what tripped me up - JIRA’s field validation timing is weird. Sometimes it validates the child field against the parent’s current state instead of the new value you’re sending in the same request. If you’re getting random failures, split it into two updateIssue calls. Update the parent first, then the child in a separate call. Not great for performance but kills the race conditions. Also, some cascading setups need you to clear the child field before setting a new parent value.

This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.