Clone Epic, Stories and Subtasks tree with Jira Automation

Update: Jul/26/2024

Since the Epic Link field is getting deprecated, now you need to use the Parent field to link Standard issues to their Epic parent:

Screenshot 2024-09-06 at 9.55.38 a.m..png

 

Original Post:

Currently, there is no way to directly clone the stories and subtasks under an Epic in Jira. Indeed there is a feature request in place to add this functionality:

As a workaround, you can use Jira automation to solve this problem. For this, you will need to create the next two automation rules in your project:

1st Rule. Clone the Epic and the child issues

Clone the Epic

1.png

Save the epic ID

2.png

Clone each child linking the new issue to the new Epic, using the Parent field (Epic Link will be deprecated), and append the original issue key to the newly created issue; this will help to identify the issue in the next rule to clone the subtasks.

Screenshot 2024-09-06 at 10.02.18 a.m..png

 

2nd Rule. Clone subtasks.

Since the result of the 1st rule will trigger this new rule, you need to enable the checkbox shown below:

4.png

Create a variable to know from which original issue the new issue was cloned.

5.png

smart value: {{issue.summary.replaceAll("(.*key:)","")}}

Remove the old key from the summary string:

6.png

smart value: {{issue.summary.replaceAll("(key:.*$)","")}}

Look for subtasks from the original issue:

7.png

Clone each subtask, selecting the trigger issue as the parent:

8.png

If you need to clone the issue links or the attachments you can add the fields in the clone action as follows:

Screen Shot 2023-03-30 at 10.49.24.png

Please note some elements can't be cloned, like the history, comments, or logged time.

I hope that this article is useful for you and helps to improve your team's productivity using Jira and Jira Automation.

50 comments

Yatish Madhav
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.
March 30, 2023

Thanks for this article @Jorge H 

We have looked for a way to to this for some time (without an add on) and have done so using the REST API quite successfully with the option to clone to a differant project, set due date or assignee based on user requirements ...

Thanks for this too :)

Jorge H
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 6, 2023

Thanks a lot for your feedback @Yatish Madhav. I hope you and many of our customers can benefit from this solution.

BR,

Jorge Herrera

Like # people like this
Kelli Frattini-Adams
Contributor
April 21, 2023

@Jorge H I'm so glad you posted this! I have the first part working just fine - the create epic and all child issues. But I'm stumped on the subtask piece. I've copied everything you have but no subtasks are created. One caveat, I am using a custom subtype - "Sub-Testcase" but it is a subtask issue type.  Please help. I'm banging my head over here as I can't figure out what is wrong. When I check audit log too, it says successful but no subtest cases created.  Thanks so much!Automation-JIRA (1).pngAutomation-JIRA (2).pngAutomation-JIRA (3).pngAutomation-JIRA (4).png

Jorge H
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 8, 2023

Hi @Kelli Frattini-Adams,

I hope you are having a great day!

I see the regex to extract the original issue is not correct, I should be:

smart value: {{issue.summary.replaceAll("(.*key:)","")}}

And as per your snapshots, I see you are using the one to fix the summary (which is basically opposite to the other smart value).

Please, let us know if this has solved your problem.

BR,

Jorge

Michael Cerantola June 19, 2023

I would love to set this up in my automation board but I am having problems seeing the field "Epic Key"  under the summary description of the triggers. 

We have an epic in the Roadmap planner with 52 Child Tasks and we would love to be able to clone everything and not have to do this manually. It has taken me so long to approve a 50 seat user access that I doubt I'll be able to get the IT team to pay for another add on to do this for me.

 

 

whereisepickey.png

Like Clara Wölk likes this
Nat Gaston
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 27, 2023

This is an excellent guide, and is the perfect work around for our team that needs to fully clone an Epic with tasks and sub-tasks. Thank you Jorge for the write up, it is much appreciated! 

Like Jorge H likes this
Mauricio Heberle
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.
June 30, 2023

How would you do this for Initiative -> Epic -> Tasks? I can clone the Iniative and all the epics, even the tasks, but I cant find a way to link the tasks to the new epics. 

If only we could branch inside a branch, would make this so much easier

Like # people like this
Michelle Rose
Contributor
July 24, 2023

@Jorge H Thank you for the write-up, it's very helpful. I built the sub-task automation exactly as your pictures outlined but I am getting an error message on the condition "summary contains key:" saying that the condition isn't met. I'll send pictures of my automation.

sub-task automation 1.png

Michelle Rose
Contributor
July 24, 2023

sub-task automation 2.png

Michelle Rose
Contributor
July 24, 2023

sub-task automation 3.png

Michelle Rose
Contributor
July 24, 2023

sub-task automation 4.png

Michelle Rose
Contributor
July 24, 2023

sub-task automation 5.png

Tina Rusnak July 25, 2023

Hello, I am nearly complete! I can either have the epic and stories clone perfectly without the sub-tasks working OR I get the Epics and sub-tasks perfectly, but the User Story. Task, etc Summary Name is not correct. Screen shots attached - If I remove that summary "key" string, then the sub-tasks work but the issue name is just the clone issue number no text. Below I am using it, the text and the issue is in the summary which is not bad but then the sub-tasks did not clone. Thank you!

 

Screen Shot 2023-07-25 at 7.07.33 PM.pngScreen Shot 2023-07-25 at 7.07.43 PM.pngScreen Shot 2023-07-25 at 7.08.12 PM.pngScreen Shot 2023-07-25 at 7.08.19 PM.pngScreen Shot 2023-07-25 at 7.08.38 PM.pngScreen Shot 2023-07-25 at 7.08.56 PM.pngScreen Shot 2023-07-25 at 7.09.07 PM.pngScreen Shot 2023-07-25 at 7.09.24 PM.pngthank you!

Tina Rusnak July 25, 2023

Eureka! Found a typo - works marvelous!

Like Jorge H likes this
Carlos Henrique Guardão Gandarez
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 28, 2023

It solved my life! Thanks!

Like Jorge H likes this
Michelle Rose
Contributor
July 31, 2023

@Tina Rusnak Thanks for posting screenshots! I copied your rules exactly as you have them but I still have a failure... I can't get past the "summary contains key condition." Can you help me troubleshoot?

 

Screenshot 2023-07-31 at 1.17.57 PM.png

Like Tina Rusnak likes this
Tina Rusnak August 1, 2023

@Michelle rose can you share your Epic clone setup screenshots? There is a typo in one of my entries, I'm trying to remember what it was, that may be why, if you copied me it's not working! I'm looking, I believe issue is in your step 1 automation for the Epic and Issue types.

Jorge H
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 1, 2023

Hi @Michelle Rose 

Thanks for trying this solution. If the condition looking for "key:" is not met. it cloud be possible that the string is not added in the first rule:

Screenshot 2023-08-01 at 12.06.01.png

This part is important to let the 2nd rule know the original issue where each Epic child was cloned from, so the 2nd rule can find and clone the subtasks for each Epic child.

Like Tina Rusnak likes this
GC
Contributor
August 22, 2023

@Jorge H thank you for the detailed tutorial - it all almost works perfectly but...

Like @Tina Rusnak I am getting the original key number appended at the end of every task summary 

I'm not sure what I'm doing wrong here - did either one of you figure it out? 

Sean Saxon August 22, 2023

@GC - double check your configuration for Screen Shot 2023-07-25 at 7.08.38 PM.png

Tina had a typo in the "Summary", it should be:

{{issue.summary}}key:{{issue.key}}

Notice the "key:", which was missing from Tina's original screen cap.  I removed the semicolon fron the summary and confirmed that will return the original issue key when cloning. 

GC
Contributor
August 23, 2023

Hi @Sean Saxon thanks for responding.

All good, turns out i hadnt turned on the second automation for that project so there was nothing clearing the key - my bad! 

Carlos Garcia Navarro
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 2, 2023

Thanks for sharing! Great article!

Like Jorge H likes this
hanumanthu.e September 11, 2023

Hi @Jorge H thank you for the detailed tutorial. Everything working fine for me.

Like Jorge H likes this
Lubova Uvarova
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 19, 2023

Hello! Created the rules based on the instructions, but once I try to clone the Epic with the children I get the page with the text: There's nothing here, yet. What am I doing worng? Is there an issue with the rights, cause I am an admin of the project

WM-Screenshots-20230919161336.png

Mitja Mitruševski
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 26, 2023

Hi all! First of all thank you very much for this automation @Jorge H . But I have an issue with the branch JQL in the ''sub-task'' triggered rule. As you can see from the photo below; it seems that it can't find related issue. Could some one help me out please. 

Thanks in advance!Automation - JIRA 01.pngAutomation - JIRA 02.png

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events