Add Subtasks to a issue when a sub task on another issue is done
Asked by Sarah Isaacs:

Hi

Please can you help. I have an Automation that does this:

When Transitioned from To Do to Done

* If the Sub task matches - Decide Which Synopsis

For the Parent

* Create a new issue in the same project - summary - {{issue.epic.summary}} - Writing C2
* Create a sub task - {{issue.epicLink}}

For the Parent

Then Transition the completed issue Writing C1 to done.

Its not working as the sub task does not create on the newly created writing card 2? I have tried - {{createIssue.key}}

Please can someone help? I've tried so many ways to do it.![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/313106i57E96D57DE3FC3F8/image-size/large?v=v2&px=999 "image.png")![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/313107i057DDEA61BEF7B4F/image-size/large?v=v2&px=999 "image.png")


Answers:
author: Trudy Claspill
body: Hello [@Sarah Isaacs](/t5/user/viewprofilepage/user-id/5270255)

As the rule is currently written, at the point where you create the new Subtask it is the Parent of the trigger issue that is "in focus" so the subtask will be created under that issue.

If you want the new Subtask created under the newly created Writing issue then you can change the Parent of that subtask to the newly created issue within the Create Issue action for the Subtask.

![Screenshot 2024-03-19 at 11.12.46?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/313108i00D9D24FFB773CF3/image-size/large?v=v2&px=999 "Screenshot 2024-03-19 at 11.12.46?AM.png")

comments: author: Sarah Isaacs
body: HI [@Trudy Claspill](/t5/user/viewprofilepage/user-id/3569011)

Thanks for coming back to me so I have tried as you have suggested. I had tried something very similar but had put {{createissue.key}} not {{createdIssue.key}}. So I was super hopeful. But it still doesn't work? I don't understand why I get an error creating issue. ![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/313111i79259F356FF49832/image-size/large?v=v2&px=999 "image.png")

Any help would be amazing thanks so much as you know because you've answered my questions before I'm still quite new to this.

Thank you


author: Trudy Claspill
body: Can you who the details of your rule after the updates and the details of the step for creating the subtask?

In your original image I see that your subtask creation task is naming a specific project.

![Screenshot 2024-03-19 at 11.52.19?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/313113i507534ECD6F91CC3/image-size/large?v=v2&px=999 "Screenshot 2024-03-19 at 11.52.19?AM.png")

Is that the same project where the preceding new issue was created?

![Screenshot 2024-03-19 at 11.53.26?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/313114i92E5156621F5CBF3/image-size/large?v=v2&px=999 "Screenshot 2024-03-19 at 11.53.26?AM.png")

The subtask has to be in the same project as its parent task.


author: Sarah Isaacs
body: Hey Trudy

It works, It works . Thanks a million. One missing letter.

Thank you


author: Trudy Claspill
body: Great!

If your problem has been solved with the help of my responses then please consider clicking the Accept Answer button.


author: Sarah Isaacs
body: [@Trudy Claspill](/t5/user/viewprofilepage/user-id/3569011) Sorry to come back to you but I have another question on this please? So I have created one sub task to be the child of the new task I created as per above using the smart value --{{createdissue.key}}--.

The problem is I want to create 4 more sub tasks that would have the same parent - the newly created task. So I added another Create new Action and added the Smart Value again --{{createdissue.key}}--.

I get a can't create issue error.

Now I think this is because the created issue key is referring to the first sub task I created?

So how do I fix this please?

Thanks so much

Sarah![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/313848iE744B086FEDE400C/image-size/large?v=v2&px=999 "image.png")![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/313849iA3421F42FF1C870C/image-size/large?v=v2&px=999 "image.png")![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/313850iEE84D31B0EEA0662/image-size/large?v=v2&px=999 "image.png")


author: Trudy Claspill
body: You could use the Create Variable action to create a separate variable to store the issue key of the first created issue. Then use that variable in the creation of the subtasks.

![Screenshot 2024-03-22 at 7.31.01?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/313864i44EF2820338A5B30/image-size/large?v=v2&px=999 "Screenshot 2024-03-22 at 7.31.01?AM.png")![Screenshot 2024-03-22 at 7.31.51?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/313863iCE38E8137801D493/image-size/large?v=v2&px=999 "Screenshot 2024-03-22 at 7.31.51?AM.png")


author: Sarah Isaacs
body: [@Trudy Claspill](/t5/user/viewprofilepage/user-id/5309476) You are so clever this is amazing. thanks much. So there is one more thing this automation needs to do.

Which is to transition the new writing C2 card to the Storyboard column and the writing C1 card to Done.

I've got the c1 Card going to Done. Its the newly created card I can't transition.

This to be honest it part of my work around as I can't access the sprint, as we talked about in a previous question. So instead I send an email to the Team Leader to ask them to move the issue manually from the backlog to the sprint. It would be great if they didn't have to also move it to the right column.

Is that possible? Your advise is amazing thank you.


author: Trudy Claspill
body: The ideal solution would be to branch to the newly created issue. Unfortunately you can't nest a branch within a branch.

Creating a separate branch in the main line of the rule to branch to the newly created issue is also not a good option because Branches may execute in parallel rather than sequentially. Setting up another branch to the newly created issue could result in that branch running before the new issue is actually created.

So, my advice is to do something like add a special label to the new issue as you create it. Then create a separate rule, triggered on Issue Created, add a Condition to look for that special label value, then have an Action to transition the issue, and then an Edit action to remove the special label.

There might be another way to accomplish it all in the first rule, but I know the above suggestion will work.


author: Sarah Isaacs
body: hey [@Trudy Claspill](/t5/user/viewprofilepage/user-id/3569011) So I've tried this. But no luck.

Here is what I have done and tried. I have a label field on the Issue type writing.

I have added the labels to my create issue on automation 1 (the automation that creates the issue and the sub tasks). See the image. I called my label Rhino_column_Storyboard

I then created a second automation as you suggested. With the trigger created issue, this didn't work. The automation never seemed to be called. So I have tried a values changes trigger.

Nothing seems to work is it because its creating the new issue and its in the backlog and not on the board, as I can add it directly to the sprint, or is it me doing it wrong please? Thanks so much

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

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/314290iFF9EF8FEA35DB779/image-size/large?v=v2&px=999 "image.png")![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/314291i54B9308FF3F15524/image-size/large?v=v2&px=999 "image.png")![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/314292i0EAAF988A68337A2/image-size/large?v=v2&px=999 "image.png")


author: Trudy Claspill
body: For the second rule you need to go to the Rule Details page and check the box below Actor for "Check to allow other rule actions to trigger this rule."

![Screenshot 2024-03-25 at 1.32.10?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/314296i9B33DA791A2B31B8/image-size/large?v=v2&px=999 "Screenshot 2024-03-25 at 1.32.10?PM.png")


Tags: team-managed-projects