Working with related issues

In the real world, a Jira issue rarely exists in isolation. Issues can have sub-tasks, be stories part of a larger epic, or simply be linked to other issues using certain relationships.

Many times when automating, we need to apply certain actions not just to the source issue that triggered an automation rule, but also issues that are related to that source issue.

Automation for Jira makes this extremely easy with our Branch rule / Related issues action as well as our Related issues condition.

Synchronizing parent & sub-task status updates

A perfect example for this is when a parent issue moves to Done in its workflow, it's usually desirable to also move its sub-tasks to Done.

Here's a quick rule to make this happen: Sync Parent and subtasks

Accessing the trigger issue

Normally the smart value {{issue}} would access the issue produced by a rule's trigger. On a related issue branch, this changes however! In an action on a related issue branch, {{issue}} now refers to the related issue produced by the branch (e.g. each sub-task in the example above).

Sometimes you still want to be able to access the issue produced by the trigger however in an action on the related branch (to copy a value). You can still do this with the special {{triggerIssue}} smart value. It works exaclty the same as {{issue}} and will give you access to all of the trigger issue's fields.

Accessing created issues

Automation rules can create issues with our create issue or clone issue actions. Performing further actions (e.g. adding a comment, creating sub-tasks) on newly created issues in the same rule also requires a related issue branch.

The reason for this is that the main rule execution branch of an automation rule always has the trigger issue in context (not the created issue). So adding a 'Comment issue' action after a 'Create issue' action in a rule, would add the comment to the trigger issue, not the created issue.

Here's an example rule to solve this problem: Related created issues

You can also select the 'Most recently created' issue in the 'Related issues' action if that's the only one you need to action.

More use-cases

Working with sub-tasks is not all though - the 'Related issues action' can branch a rule execution for many different types of related issues:

  • The current trigger issue
  • Sub-tasks
  • Stories in an Epic
  • Linked issues
  • All issues created by previous 'Create issue' actions in the rule
  • The most recently created issue by a previous 'Create issue' action in the rule
  • Issues found via a JQL
  • Epic (of the trigger issue)
  • Parent (of the trigger issue)