1

I am using the jira rest api in python (jupyter notebook) and want to get the display name of a custom field from Jira.

The custom attribute I am using represents Team Name in Jira. ex. 202 = "A Team", 204 = "The Brew Team", etc.

when I for loop I am able to get team id's but I'd like to get the display names ("A Team", "The Brew Team", etc.)

for item in project:
    team = item.fields.customfield_26588
    print(team)

Is there a way to get the actual display names from the custom field programatically?

2 Answers 2

1

Jira issue doesn't hold that information, jira instance does, since they associate the field with the issueType

you can get ALL the fields form the jira Instance, and match them against the ones in the issue with the id.

jira = JIRA(server=SERVER, basic_auth=(USER, PW))
issue_x = jira.issue("TEST-101")

all_the_fields = jira.fields()
for i in all_the_fields:
    for xx in issue_x.raw['fields']:
        if i["id"] == xx:
            print(i)
Sign up to request clarification or add additional context in comments.

Comments

0

Object of custom field looks like:

"customfield_1234": {
  "required": false,
  "schema": {...},
  "name": "Name",
  "allowedValues": [...]
}

If you want to have name of the custom field itself, you can get it from 'name' attribute of object. So, in your code you need to use:

print team.name

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.