pycontribs/jira

For issues returned from search_issues(), get_field() does not work for custom fields.

vectro opened this issue · 0 comments

vectro commented

Bug summary

When the display name of a custom field is passed into the fields parameter of search_issues(), the field name is correctly mapped to the internal Jira field name when placing the search request. However, afterwards the field values are only mapped back to the display name in the raw attribute of issues, which means that calling get_field() on one of the returned issues with the displayed field name will raise an AttributeError exception.

Is there an existing issue for this?

  • I have searched the existing issues

Jira Instance type

Jira Server or Data Center (Self-hosted)

Jira instance version

8.20.11

jira-python version

3.5.2

Python Interpreter version

3.9.6

Which operating systems have you used?

  • Linux
  • macOS
  • Windows

Reproduction steps

1. Given a Jira client instance

jira: JIRA

2. Call search_issues() with a custom field.

issues = jira.search_issues(jql=..., fields=['My custom field'])

3. Try to call get_field() on one of the returned issues.

my_custom_field_value = issues[0].get_field('My custom field')

Stack trace

[15] > jira/resources.py(701)get_field()
-> return getattr(self.fields, field_name)
AttributeError: 'PropertyHolder' object has no attribute 'My custom field'

Expected behaviour

Value of custom field would be returned.

Additional Context

No response