How do you determine the name of a custom field in jira-python?
When I retrieve an issue, my custom fields show up as customfield_xxx
The names on my screen are 'project', 'name', 'due date', etc. Short of putting a value in each field, then seeing where it appears when I re-read the issue.
That is I can put 'a' in one of my fields, then read the issue, and find that customfield_10801 (or whatever) has the value 'a'. But is there a general way to find, for example, if my custom field is 'due date', which customfield_xxx does it get mapped to?
Or, in the JIRA GUI, how would I look up these customfield #'s.
From the GUI you can see the custom field id in the html code or url:
Another way is via the REST API:
Update:
Based on the comments it can be done something like this:
# Fetch all fields
allfields=jira.fields()
# Make a map from field name -> field id
nameMap = {field['name']:field['id'] for field in allfields}
# Fetch an issue
issue = jira.issue('ABC-1')
# You can now look up custom fields by name using the map
getattr(issue.fields, nameMap[custom_name])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With