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
TAGS
atlassian, mindful member, mindful member badge, atlassian community, community kudos, community giveaway, atlassian swag, community values, empathy and kindness, badge challenge, atlassian learning, community engagement, swag giveaway

Earn a Badge, Win a Prize 🎁

Earning the Mindful Member badge proves you know how to lead with kindness, plus it enters you into a giveaway for exclusive Atlassian swag. Take the quiz, grab the badge, and comment on our announcement article to spread the good vibes!

Start here
AUG Leaders

Atlassian Community Events