Synchronize parent and sub-tasks issues
Automation for Jira Server solves thousands of use cases but synching parents and sub-tasks is probably the most common.
Typically if your ‘parent’ issue transitions to ‘done’, you will want the sub-tasks to obediently follow them. Using our related issues branch, this is simple.
- Use an Issue Transitioned Trigger (can be to a status of your choice or simply any transition).
- Now we can ‘branch’ the rule to work on related issues. In this case, we will work on sub-tasks but it could just as easily be linked issues, epic, or something you set using JQL.
- On this branch, choose the transition issue action. By default, it will copy the status of the trigger issue but you can choose whatever you like here.
- You could include a condition such as the Issue Fields Condition to refine the rule a little further.
What else can we sync in Jira?
It is rare for a Jira issue to exist in isolation. So, in the branch rule, we have made it possible for you to work across pretty much anything. This includes:
- Stories (in Epics)
- Linked issues
- Created issues (issues created by other actions previously in the rule)
- JQL (simply search for related issues with JQL)
- Epic (the parent of a story)
- Parent (the parent issue of a sub-task)
- Issues fixed in version
- Issues fixed in sprint
You can then use all of the same conditions and actions you’re used to, to perform tasks with the related issues!
Sample use cases
There’s a huge number of new use-cases that this can be used for. Just a couple of the more popular ones:
- Copying field values from the parent issue to its sub-tasks
- Update all stories in an Epic when the Epic changes
- Transition-related issues when a parent issue is transitioned
- Update the parent issue when a sub-task is updated
- Comment on linked issues when an issue is resolved.
Smarter smart-values!
But wait there’s more! Smart-values got even smarter! You can now also easily get access to a parent or epic’s data via:
{{issue.parent.fields.some field}}
or {{issue.epic.fields.another field}}
For components in a related issues branch, you can always access the issue that originally triggered the automation rule via {{triggerIssue}}
, so you can access {{triggerIssue.fields.assignee.displayName}} for example.
Smart values can now also be used anywhere you use JQL (so you can search for “parent = {{issue.key}}”) and you no longer need to lookup custom fields by ID! The following two smart-values are now equivalent:
{{issue.fields.customfield_10023}}
and {{issue.fields.My Awesome Field}}
One more thing
It’s been a busy week here at Code Barrel, but there was one more thing we wanted to ship to complete the “Related Issues” story — a new condition to check if all (or some) related issues match a given JQL query!
Update on related issues condition*
Since we wrote this blog, we have built a new condition called the Issue Fields Condition which makes things even simpler. While the related issue condition can still be very useful, this new condition means you don’t need to worry about JQL so much.
This will allow you to for example transition a parent to “Done” if and only if all sub-tasks have been completed!