Today I came across a challenge within Jira trying to automate labels from my Epics to their child issues (similar to this post). I knew this should be possible within the data model. Unfortunately, as with many obstacles in Jira, you may find yourself one Atlassian ignored feature/ability away from doing what you set out to do.
With that said, I will give credit where it’s due and say that I’m very impressed with Atlassian’s visible changes the past couple years, the release of Next-Gen projects, and the brilliant acquisition of Automations for Jira which I used for today’s solution, (now if they could just acquire some of the capabilities with the constantly referenced ScriptRunner).
My goal was to come up with a solution that didn’t require a 3rd party solution, and thankfully I came up with something that works for me and may work for others. For my requirements I wanted to set a “Project” specific label on an Epic and have it distributed to the issues within it. When attempting something like this there are several things to consider:
- Updating the Epic versus the Issues within it causes complexity managing the various ways users could trigger a change
- The Label field is complex and does not support wildcard/fuzzy searching (see community thread here)
- You can’t loop through field values such as labels (noted here), which can make it difficult to get your specific label from the list as well
To simplify the complexities around labels I decided to create a custom field which I called “Business Project.” To keep things consistent I made this a Single Value (this varies from Classic to Next-Gen Projects).
Next I setup this simple automation that triggers anytime an issue is created/updated and modifies the “Business Project” field value. Here are some quick and dirty screenshots to demonstrate.
Just a few easy steps to provide a reasonable process automation.
This Field Value Changed trigger should monitor your custom field for changes, in this instance I intend to do this for all issue operations as well.
Using the context of the Smart Value variables from the trigger we can add and remove the labels based on the custom field value
Simply branch a loop of all the related issues within the Epic (in the instance that the trigger issue is an Epic)
Child Issue Actions:
Similarly you will then edit each child issue in the same way, adding and removing the label based on the custom field value. Additionally, presuming the custom field exist on these issues as well you may want to set that field value as well based on the parent Epic. This will help the individual issue process through the automation consistently if ever it’s values are changed for some reason.
I am still considering other options to make this automation more thorough but for now I think this will provide an 80% solution that my team can live with. I do think that a ScriptRunner solution would be able to provide a more comprehensive solution but unfortunately I’ve never used the tool and don’t have the time to learn it but if any readers have some ideas on how to achieve this, I think this is a solid business use case to share.
Hope this helps someone facing a similar issue, if it saves you any time please let me know in the comments.