Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automating link creation between subtasks by linking to next subtask each time upon creation

VVC
Contributor
May 2, 2025

Would it be possible to automate the linking of subtasks upon creation regardless of tickets created in out of order within one Jira project?

 

The expectation on the automation or scripting is to retrieve all the subtasks then sort by either creation date/time or issue key or any parameter that fits best under the parent issue and then looping through the results to link one subtask ticket to the immediate next one. 

2 answers

1 vote
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 2, 2025

Hi @VVC 

What you describe is not possible with automation rules using branches as they execute in parallel / asynchronously, and so one could not loop through them in a defined order.  There are open suggestions to make the processing configurable, at least for Jira Cloud automation.

The only way I know to do this for an automation rule is to explicitly create the issues, one by one, adding the links as the rule proceeds, without branching.

 

Possible workarounds might be:

  • investigate marketplace scripting apps / addons which support sequential processing, or
  • build your own service which processes sequentially using the REST API endpoints and call that from an automation rule using the Send Web Request action.

 

Kind regards,
Bill

0 votes
Trudy Claspill
Community Champion
May 2, 2025

One possible solution is to create the link as the subtasks are created, using an Automation rule.

Trigger: issue created

Condition: Issue type is sub-task

Action: Lookup Issues
Use a JQL to find all the subtasks under the same parent, excluding the current subtask, and order by the parameter you choose so that "last" one to which you would want to link the new subtask would be at the top of the list

key != {{triggerIssue.key}} and parent={{triggerIssue.parent.key}} order by created desc

Action: Edit Issue
Edit the newly created subtask. Add the Linked Issues field. Choose your link type (i.e. depends on). To link to the issue that appears first in the list of issues returned by the Lookup enter the smart value {{lookupIssues.first.key}}

VVC
Contributor
May 2, 2025

Thanks @Trudy Claspill . I will implement your automation solution and let you know how it works out for our scenario.

Like • Trudy Claspill likes this
VVC
Contributor
June 6, 2025

After internal review, it looks like the linking of subtasks between predecessor and successor is completely random and non-sequential order. At times, a predecessor subtask is linked to multiple subtasks and also, there may be a scenario where the last subtask is linked to parent/main issue.

In view of this, I have proposed for linking the subtasks with a specific link type irrespective of whatever the order and count of subtasks for linkage. Also, another link type when linking subtask to the main issue. Using my automation rule, the successor subtask assignee has been notified when a predecessor subtask is set to DONE.

Besides the above, if the user forgets to link the subtasks after creation, a remainder notification alert goes out to the assignee of current subtask assignee too.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
PRODUCT PLAN
STANDARD
TAGS
atlassian, jira product discovery, jpd premium, product management, idea management, product discovery, jira premium, product planning, atlassian community, product development, roadmap planning, product prioritization, feature management

Introducing Jira Product Discovery Premium ✨

Jira Product Discovery Premium is now available! Get more visibility, control, and support to build products at scale.

Learn more
AUG Leaders

Atlassian Community Events