Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Python API: How do I access a custom field with multiple values

Maheshvaran Padiachi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 4, 2022

Hi All

 

I am able to access custom fields from the JIRA Python API.

However there is one field or combination field to which I cannot access the second value.

I have pasted a sample of the Issue XML below and rehashed the numbers for ease.

 

When calling a function like:

getattr(singleIssue.fields, nameMap["PI Cycle/Iteration"]).value
I am able to get the value from customfieldvalue key="55555" by default,
But I cannot get the value from customfieldvalue key="66666"
They both fall under the same customField name/id

Any ideas on how to access this second field from the API?

 


Additional Reference code

    allfields = jira.fields()

    nameMap = {jira.field['name']:jira.field['id'] for jira.field in allfields}

Sample Exported Issue XML

<customfield id="customfield_99999" key="com.atlassian.jira.plugin.system.customfieldtypes:cascadingselect">
<customfieldname>PI Cycle/Iteration</customfieldname>
<customfieldvalues>
<customfieldvalue key="55555" cascade-level="">
<![CDATA[ PI 13 2022 Cycle ]]>
</customfieldvalue>
<customfieldvalue key="66666" cascade-level="1">
<![CDATA[ Itn 13.5 11-May - 24-May ]]>
</customfieldvalue>
</customfieldvalues>
</customfield>

0 answers

Suggest an answer

Log in or Sign up to answer