TLDR; How do I get and set epic colors from Python?
According to https://confluence.atlassian.com/jirakb/editing-colors-through-epic-color-field-in-jira-1047551293.html I can see that when we select a color for an epic in Jira, we're actually assigning one of the preset values to a custom field called "Epic Color", such as "ghx-label-7". That page goes on to specify a LUT for what RGB colour each "ghx-label-#" maps to.
Using the Python API, I am able to obtain the ID of this custom field:
# Get the custom field ID by label
def get_custom_field_id_by_label(label):
custom_fields = jira.fields()
for field in custom_fields:
if field['name'] == label:
return field['id']
return None
which in my case returns "customfield_10013".
My problem is, I cannot see how I can either read the value of this field on any given epic (it isn't listed as any of the fields associated) or set it (I get errors about being on the wrong "screen").
For example:
json = jira.search_issues(f"id='{issue.key}'", maxResults=1, json_result=True)
I can see when looking at everything that's associated with a given issue (which I know for a fact I set the color of this epic via the GUI) I do not see any field matching customfield_10013 nor do I see anything with a value looking like "ghx-label-#".
So it's no surprise that I am unable to figure out what color the epic is when I do something along these lines:
for key, value in first_issue['fields'].items():
if key == custom_field_id:
print(key, value)
Any attempt to set/add the value of this field on an issue results in errors of this sort:
text: Field 'customfield_10013' cannot be set. It is not on the appropriate screen, or unknown.