Jira python customfield

How do you define a custom field name in jira-python?

When I get an error, my custom fields are displayed as customfield_xxx

The names on my screen are "project", "name", "completion date", etc. If you do not count the values ​​in each field, then seeing where it appears when I re-read the question.

That is, I can put 'a' in one of my fields, then read this problem and find that customfield_10801 (or something else) has the value 'a'. But is there a general way to find, for example, if my custom field is "due date" that customfield_xxx is displayed on?

Or, in the JIRA GUI, how would I look at these user # fields.

+7
python jira custom-fields
source share
1 answer

In the graphical interface, you can see the user identifier of the field in the html code or URL:

  • On the admin page, where all user-defined fields are listed in the custom field’s line, you are interested in right-clicking and clicking / hovering over “Settings”. You should see a custom field id in the url.

Another way is through the REST API:

  • {JIRA-base URL} / Rest / API / 2 / Field
  • This is a GET request, so just put this URL in your browser.

Update:

Based on the comments, this 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]) 
+8
source share

All Articles