Using Automation for Jira to setup links between child issues during creation
Asked by admin-nwalter:

Hello all,

I've looked through multiple articles and unfortunatly couldn't find one that matched my scenario or could point me in the right direction. This is the scenario.

I have an automation that automatically creates child issues for the Epic that was recently created and adds the Epic as a parent. When you open up the Epic, you'll see all of the child issues, which is good. But what I want to achieve is that the child issues that are created are linked to each other. For example:

Master Ticket 1 has been created. Child issues are

* Task A
* Task B
* Task C
* Task D
* Task E
* Task F

Task B should be linked to Task A. Task C should be linked to Task B. Task D should be linked to C etc etc.

I tried to achieve this by making making an automation based on the "Issue Created" trigger and with the condition that if an Epic has been created, it will automatically create these child issues. Between each child issue, I added a "Re-fetch Issue data" action and then a "Link issue" action, hoping I could link the issue with the most recently created one. I also tried linking it based on the summary, but both options failed. I used the blocked by and related to links, to no avail.

Is there a way that I can achieve this using automation? The goal actually is that these tasks need to be taken cared of by different departments and need to be closed in a specific order. So when Task A is done, only then can Task B proceed.


Answers:
author: admin-nwalter
body: I found a way to do this, but I cannot close this case myself unfortunately.

comments: author: Nicole_Selph
body: [@admin-nwalter](/t5/user/viewprofilepage/user-id/4668680) would be really interested in how you solved this as I am trying to do the exact same thing and having trouble getting it to work. Are you able to share a screenshot of your rule?


author: admin-nwalter
body: Dear [@Nicole_Selph](/t5/user/viewprofilepage/user-id/5501577) , please check the answer I've given Margolles and please check if this applies to you as well?


author: margolles
body: Hi [admin-nwalter](https://community.atlassian.com/t5/user/viewprofilepage/user-id/4668680),

could you share how did you solve that issue? I am trying exactly the same.

Thank you!

comments: author: admin-nwalter
body: Hello [@margolles](/t5/user/viewprofilepage/user-id/5408962)

Apologies for the late reply. I will try to explain as clear as possible. This is what worked for my scenario.

There are actually multiple rules as I had to notify multiple departments within the company, but I'll try to keep it at one rule and you can make changes where ever needed.

![Screenshot_1011.png](https://community.atlassian.com/t5/image/serverpage/image-id/334464iB72CD46CA330393C/image-size/large?v=v2&px=999 "Screenshot_1011.png")

As you can see, what I have done is that I have created several child tickets. Each child issue in this automation rule has the "Parent" field that is set to the trigger issue, which is the Epic in this case. After each "Create Task" action, I created another action that creates a variable. After the second variable, I created a branch that checks the most recently created issue and then links it to the variable that I made earlier in the automation.

By doing it in this order, it allows you to create the child issues that are linked to the Epic, but also are linked to each other in the order that you put the automation. Example:

* **If**: Issue Type equals Epic
* **Then**: Create a new Task "Team1" with the Parent field set to Trigger Issue
* **And**: Create a Variable {{Team1}}
* **And**: Create a new Task "Team 2" with the Parent field set to Trigger Issue
* **And** : Create a Variable {{Team2}}  
  * **Branch**: For Most recently created issue
  * **Then**: Link issue (is blocked by {{Team 1}}"
* **Then**: Create a new Task "Team 3" with the Parent field set to Trigger Issue
* **And:** Create a Variable {{Team3}}
  * **Branch**: For Most recently created issue
  * **Then**: Link issue (is blocked by {{Team 2}}"

By following this pattern, you'll be able to create a link between the task tickets. Please let me know if this helped fix your issue.


Tags: cloud

jira-service-management

jira-service-management-cloud