Hi
I needed to add a new level above Epic into an existing hierarchy. So the hierarchy would change from
Initiative - Milestone - Epic
to
Initiative - Milestone - Feature - Epic
The challenge was to do this without orphaning the Epics and losing the relationships with their parent Milestones (which will become their grandparents), and without a lot of manual work. I didn't find any solutions in the documentation or Q&A so I'm writing up what I did as it might be helpful to other people.
I used automation rules with the scheduled trigger but ran them once and then disabled them. Automation is very useful for running one-off rules.
Step 1
First I needed to identify the Milestones which have Epic children. I ran a 'scheduled' rule with JQL looking for relevant Milestones, It did a lookup of issuetype = Epic AND "Parent Link" = {{issue.key}} then if {{lookupIssues.size}} does not equal 0, it added a label 'hasEpics'.
Step 2
Then I added the new Feature issuetype into the project and into the hierarchy at the Epic level.
Step 3
Then I used another scheduled rule (run once and disable) to create a placeholder Feature ticket for each Milestone which has the label hasEpics. I gave them the summary Feature for: {{issue.summary}} and in the 'more options' section included this:
{
"fields": {
"customfield_12700": "{{issue.key}}"
}
}
customfield_12700 is id of Parent Link in my site, I believe it is different in different sites.
Step 4
Then I ran a rule to put the key of the placeholder Features into a short text field on their sibling Epics. It could be any short text field, I used 'Supplier Name'. So it was a scheduled (one-off) rule again, on JQL looking for all Features. Then branch on JQL
issuetype = Epic AND "Parent Link" = "{{issue.customfield_12700.data.key}}"
And in the branch, edit Supplier Name with {{triggerIssue.key}}
Step 5
Then I changed the hierarchy, creating the new level, taking Feature issuetype out of the Epic level and adding it to the new Feature level.
Step 6
Then I needed to run a rule on all Epics whose 'Supplier Name' is not empty, and edit them to put the key that was in Supplier Name into the Parent Link:
{
"fields": {
"customfield_12700": "{{issue.Supplier Name}}"
}
}
So the Epics are now children of the placeholder Features and grandchildren of their original Milestones.
Then just a bit of cleanup to wipe the Supplier Name field on the Epics. And make sure that all those one-off rules are disabled!