I'm using the Jira module for Python to make an API request - it's returning all the epics within a date range. That works fine. I am then going through those epics and looking for a custom fied - customfield_13628 and checking if it has a value or not and if not defaulting to a value.
The field I am checking is a date field. The test epic I am using has a value for that field.
and if I run a filter in Jira it shows the value:
and I know I have the right custom field because I can sort the filter results by it:
project = KME AND issuetype = Epic AND created >= 2023-12-01 ORDER BY cf[13628] ASC, created DESC
However, when I run this code, the value for customfield_13628 is None, it should be 2024-01-24 or some iteration of a date.
try:
for thisEpic in lstEpics:
print(thisEpic.fields.customfield_13628)
dictThisEpic = {"key":thisEpic.key, "summary":thisEpic.fields.summary, "timeestimate":thisEpic.fields.aggregatetimeestimate, "timespent":thisEpic.fields.aggregatetimespent, "start-date": getattr(thisEpic.fields, 'customfield_ 13628', "No Start Date")}
print(dictThisEpic)
break
except Exception as e:
print(f"{cm.WARNING}There was an issues getting the Jira epics details for: {thisEpic}\n{e}{cm.ENDC}")
The first print command outputs: None.
The second one outputs:
{'key': 'KME-8524', 'summary': 'Test: Ignore this Epic', 'timeestimate': None, 'timespent': None, 'start-date': 'No Start Date'}
I know the custom field is being returned with the Epic because I can run this code:
print(dir(thisEpic.fields.customfield_13628))
and get this output:
['__bool__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__']
So I am confused as to why this custom field's value is not being returned with the request. Any help would be appreciated.