Cloning Epics including stories - Jira Automation

Kurt Smith March 11, 2022

I found a solution that is working for some folks but not for me.  Any suggestions?  I'm using Jira Cloud.

This clones everything that is linked directly to the epic. You could define the same rule-logic for the story-subtask relation ship.

2021-11-05_17h47_20.png

 

Details of "Clone" Block:

2021-11-05_17h49_27.png

 

If you are using Jira Premium you can also use "portfolioChildIssuesOf" to gather the tickets inside the epic which would also fetch sub-tasks.

However now you need to pay attention that your Automation does not try to link cloned subtasks to the new epic.

5 answers

1 accepted

2 votes
Answer accepted
Marc October 13, 2022

This works for me:

1. Run when issue linked via "Cloners"

2. Condition: only if the issue type is Epic AND it's linked "is cloned by" - meaning the issue you just cloned

3. Scriptrunner query to get the issues in the Epic linked to the Epic that was just cloned

issuefunction in issuesinepics("issuefunction in linkedissuesof(\"key = {{triggerissue}}\",\"clones\")")

4. Clone issues in Epic and set the Epic Link to the Trigger issue

5. Delete the issue link "clones"

 

Screen Shot 2022-10-13 at 4.16.25 PM.pngScreen Shot 2022-10-13 at 4.19.31 PM.png

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 14, 2022

Hello @Marc 

"issueFunction" is not native to Jira JQL. Your solution requires a third party app. Are you using Adaptavist Scriptrunner?

Marc October 14, 2022

Yes, Scriptrunner is required in order to use that JQL function.

1 vote
Luka Hummel - codefortynine
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
July 14, 2023

Hi, I'm Luka from codefortynine 👋

While it is possible to clone hierarchies with Jira Automation, this can be quite finicky and can break easily if project or issue configurations change.

If you are open to use a third-party app, our Deep Clone for Jira can clone whole issue hierarchies, including Initiatives, Epics, Tasks/Stories, and Subtasks.

Deep Clone for Jira_Epic Tree Clone.gif

  1. Navigate to the issue you want to clone

  2. Click Action menu ••• > Deep Clone

  3. Select Epic/Tree Clone

  4. Configure and create your Epic/Tree Clone

1 vote
Melissa Lato February 1, 2023

For all those who do not want to buy a tool this has been answered via this link Clone-EPIC-amp-Stories-to-New-Epic-and-link-New-Stories 

0 votes
Taranjeet Singh
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 31, 2023

@Kurt Smith Just after spot checking your original rule (which seems to be similar to the rule that @Trudy Claspill suggested), I think that your rule is not working, maybe due to a typo error in your "Related Issues" JQL query in the smart value {{destinationissue}}. It should be {{destinationIssue}} instead. Give it a try and see if this fixes your rule.

 

I hope it helps!

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 11, 2022

How is the solution not working for you? What problem are you encountering?

Kurt Smith March 14, 2022

It simply doesn't work....the Epic clones but no stories.

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 14, 2022

Can you provide a link to the post where you got this suggestion?

I think the problem is in the branch "For JQL" where it says

"Epic Link" = {{destinationissue}}

Reviewing the information for the trigger I understand it to be saying that "issue" would be the source issue (the Epic you are cloning) and "destinationissue" would be the resulting Epic generated by the clone action. So, if you want to clone all the child issues in the source Epic then I think the branch should be

"Epic Link" = {{issue}}

I haven't tested this Automation myself, so this is just based on a desk check.

Kurt Smith March 15, 2022

Here is the original link:

Cloning Epics including stories - Jira Automation (atlassian.com)

Here is the audit log from the automation - MT-30 is the Epic being cloned and MT-48 is the clone:

Action details:
Issue linked
Destination issue (to perform actions on this issue use a 'Related branch', you can also access it via {{destinationIssue}}):
MT-30
Source issue (the main branch of the rule will execute for this issue and you can access it via {{issue}}):
MT-48
JQL condition
The following issues did not match the condition:
MT-48
This may be due to any of the following reasons:
the issue didn't match the specified JQL (most likely)
the chosen rule actor doesn't have permissions (or issue security level permissions) to view the issue
the issue was deleted or wasn't indexed by Jira yet (in rare circumstances)
We recommend using the 'Issue fields condition' for more consistent results.

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 15, 2022

Hello @Kurt Smith 

The link you provided is to this post. I am interested in the original post where you got the information about this automation.

You said MT-30 is the epic being cloned. So that Epic already exists. And when you cloned it, you say that MT-48 was created? That doesn't make sense as the numeric part of the issue key should be incremented and the newly created Epic should have an issue key with a numeric value greater than 30.

I created this rule in my own environment in a Company Managed project. I selected an existing Epic that had one child issue, and selected the Clone action from the ... menu. The rule worked correctly, creating a new Epic and creating a child under that new Epic that was a clone of the child issue under the original Epic.

I also tried manually creating a new Epic, then manually linking it to an existing Epic using the "clones" link. In that case also the child issues of the existing Epic were cloned and made children of the new Epic I had manually created.

So, I'm not sure why the rule is not working for your instance.

Apryl Harris October 12, 2022

@Trudy Claspill 

Can you please provide the automation you used to clone an epic and its child(ren)? Thank you.

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 29, 2022

@Apryl Harris 

When an Epic (B) is created by cloning an existing Epic (A), this rule will then clone the child issues of (A) and make the new issues children of (B)

  • This works only for a Company Managed project.
  • This does not include cloning Subtasks of the child issues being cloned in this rule.
  • This does not require ScriptRunner.
  • This does not work when an Epic in a Team Managed project has been cloned.
TRIGGER: Issues Linked
- Link Type: Cloners
CONDITION: Issue field condition
- Field: Issue Type
- Condition: equals
- Value: Epic
BRANCH RULE/RELATED ISSUES: JQL
- JQL: "Epic Link" = {{destinationIssue}} order by key asc
ACTION: Clone Issue
- Project: Same Project
- Issue Type: Same issue type
- Fields to set:
- Summary: {{issue.summary}}
- Epic Link: {{triggerIssue}}
ACTION: Delete Issue Links
- Link Type: is cloned by
ACTION: Edit issue
- Fields to edit:
- Epic Name: {{issue.key}}

 

Bradley January 31, 2023

This only clones the Epic it does not trigger to clone the Stories under the Epic. 

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 31, 2023

@Bradley 

There are multiple rules in this Question. Which one specifically is not working?

Are you working with Jira Cloud or Jira Server/Data Center?

Are you working with issues in a Team Managed project or a Company Managed project?

Bradley January 31, 2023

I am still trying to work out how, if I click Clone on an Epic for the automation to clone both the epic and the stories and tie them to the new epic that was just created. I am unable to get it to work.  I would love it if someone could detail it out with all the automation that would be needed I would greatly appreciate it. 

 

So finally was able to get this to work. Thank you all so much for your help. 

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 31, 2023

You want the rule itself to execute the clone of the Epic and the child stories?

The rules that are discussed in this post are for cloning the child issues of an Epic where the Epic issue has been cloned using the Clone operation directly from the Epic. These rules do not include cloning the Epic itself.

If you want an Automation Rule to clone the Epic also, what would be the trigger for cloning the Epic?

To have Automation clone the Epic and clone the child issues will actually take two rules. Rule 1 would clone just the Epic based on the trigger you define. Rule 2 would be the rule discussed in this post to clone the child issues after the Epic has been cloned.

As cloning both Epic and child issues automatically is a different topic than this post, I recommend you open a new Question to discuss it.

Like # people like this
Bradley April 4, 2023

I was finally able to get it to work. Thank you

Drew Bradford October 26, 2023

Wrong thread accidental post.

Senthil V April 12, 2024

Posted a new thread.

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 12, 2024

Hello @Senthil Sundaravadivelu 

The thread on which you have posted is quite old, and has an Accepted Answer already. Please start a brand new Question to get help with your issue.

In your Question post images that show your complete Automation Rule.

If you think this current post is relevant, include a link to it in your new Question.

Like Senthil V likes this
Senthil V April 12, 2024

Hello @Trudy Claspill  - Posted a new thread

Suggest an answer

Log in or Sign up to answer