It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Bulk Clone Pro: How to clone entire Epic (with Issues and their Sub-Tasks)?

Hi - I'm evaluating Bulk Clone Professional, and need to clone our "template" Epic.  This Epic contains a handful of Tasks ("Issues in Epic").  Each of these Tasks in the Epic have a bunch of Sub-Tasks.  How do I clone this entire structure? When I clone this "template" Epic using Bulk Clone Professional, I only specify this single Epic as needing to be cloned, because I want to end up with a cloned Epic that contains the same (cloned) Tasks as the source Epic contains, and have each of these (cloned) Tasks point to (cloned) Sub-Tasks.

So in the pic attached, the 5 "Issues in Epic" would also be cloned, and listed in the cloned Epic's "Issues in Epic" section.  Also, I need each of the Sub-Tasks (of each Task) to also be cloned.  So a full Epic clone.



5 answers

1 accepted

2 votes
Answer accepted

Ok, I figured it out.  Instead of assuming that just cloning the "top level" Epic, I need to use JQL (project = MIG and "Epic Link" = MIG-84 or issuekey  = MIG-84)  - where MIG-84 is the Epic - and clone the Epic and all of the "Issues in Epic" together.  Very cool plug-in.  

Where do you place the JQL?  The Backlog area is the only place you can multi-select (I think) and if I do a JQL search, I am taken to a Search results page where I cannot multi-select.

Hi Kristina - this is Fred, posting by mistake from my manager's account (oops ;_0 )  ... so I go to my project, and click on "view all issues and filters" in the upper right.  Make sure the "Advanced" link is clicked, and create a filter that selects the epic you want to clone - along with all of the tasks in that epic.  So for me, it's:

project = MIG AND "Epic Link" = MIG-84 OR issuekey = MIG-84 ORDER BY issuetype ASC, issuekey ASC

Then I save that filter.  When you're ready to clone that epic (with its tasks and task sub-tasks), run that filter (by going to your project, clicking on "view all issues and filters", and clicking on the filter you just saved).  

You'll now see the epics and tasks in that epic.  You won't see sub-tasks but they're cloned automatically with each task.  Now just follow the add-on instructions (go to tools -> bulk tools, change all X issues, and in bulk operations select all of them, click next, then select the add-on "clone issues", and you're off and running).


Logged in as myself (Fred) now - let me know if you have any other questions on this!

I was able to create JQL and see the list I wanted.  I don't see tools > bulk tools etc.  I'm trying to follow which recommends going to Backlog...I don't want that.

Couldn't see how to save the filter except to save it to a local file.

When you build up the filter (using either 'basic' or 'advanced'), there is a "Save As" button that you can click to save that filter.

We chose Bulk Clone Pro because we could clone Epics and their hierarchies across many different JIRA Projects.

Thanks for all of your help.  Our needs were simpler; may need this in the future though...

@Fred Lunau FYI - we ended up going with Jira Automation with a trigger on Epic creation to create all of the issues "below" the Epic.  It had more flexibility to create if/then scenarios for our agency model with multiple products plus the ability to suffix or prefix the issue names. I needed a coder to assist with the setup though.

Found out that we couldn't use the Epic cloning tool anymore because it would trigger Jira Automation.  Oops.  I'm sure there's a checkbox for that somewhere.


I needed the same some time ago. I got a solution with 2 scriptrunner REST Endpoints called sequentially. The first is called from a custom web item (Script Fragments) in the more-menu of an issue. It shows a dialog where you can set the summary/epic name of the new epic. After clicking submit, the second endpoint is called.

Here are the scripts for the two REST Endpoints:


import groovy.transform.BaseScript
import com.atlassian.jira.component.ComponentAccessor

@BaseScript CustomEndpointDelegate delegate

showDialog() { MultivaluedMap queryParams ->
//get issueKey from parameters of REST Endpoint call
def issueKey = queryParams.getFirst("issueKey") as String
String BASE_URL = ComponentAccessor.getApplicationProperties().getString(APKeys.JIRA_BASEURL);

//definition of Dialog with some Java Script
def dialog =
//On dialog the user can insert the summary/epic name of the new epic
//After clicking submit button, spinner is displayed and second REST Endpoint is called with new summary value
var newSum = AJS.\$("#text-input").val()
var spinning = false;

spinning = true;

var request = new XMLHttpRequest();"GET","${BASE_URL}/rest/scriptrunner/latest/custom/cloneEpicWithIssues?issueKey=${issueKey}&newSum="+newSum);

//Keep the dialog open for 15s, then close it and reload the source epic
function loadUrl(newLocation){
window.location.href = newLocation;
//show error message if field for new summary is empty
AJS.\$("#text-input").next().append('<div class="error">Summary for new Epic is required</div>')

//Dialog definition, got from scriptrunner documentation and adapted
<section role="dialog" id="sr-dialog" class="aui-layer aui-dialog2 aui-dialog2-medium" aria-hidden="true" data-aui-remove-on-hide="true">
<header class="aui-dialog2-header">
<h2 class="aui-dialog2-header-main">Clone Epic with Issues in Epic</h2>
<a class="aui-dialog2-header-close">
<span class="aui-icon aui-icon-small aui-iconfont-close-dialog">Close</span>

<div class="aui-dialog2-content">
<p>Please insert Summary of new Epic</p>
<form class="aui">
<div class="field-group">
<label for="text-input">New Epic Name<span class="aui-icon icon-required">required</span></label>
<input class="text" type="text" id="text-input" name="text-input" title="summary">
<div class="description">Please insert Name of new Epic</div>

<footer class="aui-dialog2-footer">
<div class="aui-dialog2-footer-actions">
<button id="dialog-submit-button" class="aui-button aui-button-primary">Submit</button>
<span style="padding-left: 15px; padding-bottom: 10px; display: inline-block;" class="button-spinner"></span>
<button id="dialog-close-button" class="aui-button aui-button-link">Cancel</button>

//Show dialog

Clone Epic:

import groovy.json.JsonOutput
import groovy.transform.BaseScript
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.sal.api.user.UserManager
import javax.servlet.http.HttpServletRequest
import org.apache.log4j.Category
import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.user.util.UserUtil
import com.onresolve.scriptrunner.runner.util.UserMessageUtil
import java.sql.Timestamp;
import org.apache.log4j.Logger;

@BaseScript CustomEndpointDelegate delegate

cloneEpicWithIssues(httpMethod: "GET") { MultivaluedMap queryParams,body, HttpServletRequest request ->

// Variable definition
def issueKey = queryParams.getFirst("issueKey") as String // issuekey from request parameters
def newSummary = queryParams.getFirst("newSum") as String // newSummary value from request parameters
def epic_link_field="customfield_12739";
def epic_name_field="customfield_12738";
def issueMgr = ComponentAccessor.getIssueManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def linkMgr = ComponentAccessor.getIssueLinkManager()
def issueFactory = ComponentAccessor.getIssueFactory()
Issue issue = issueMgr.getIssueObject(issueKey)
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
Timestamp Ts = new Timestamp(System.currentTimeMillis());
CustomField epicLink = customFieldManager.getCustomFieldObject(epic_link_field);
CustomField epicName = customFieldManager.getCustomFieldObject(epic_name_field);

//Get current issues in epic -> links from and to source epic
List<IssueLink> outwardLinks = linkMgr.getOutwardLinks(issue.getId())
List<IssueLink> inwardLinks = linkMgr.getInwardLinks(issue.getId())
List<Issue> outwardLinkedIssues = [] as List<Issue>;
List<Issue> inwardLinkedIssues = [] as List<Issue>;



//sorting of epic links - not neccessary, was requirement from users
outwardLinkedIssues.sort{a,b -> a.getId()<=>b.getId()}
outwardLinkedIssues = outwardLinkedIssues.reverse()

inwardLinkedIssues.sort{a,b -> a.getId()<=>b.getId()}
inwardLinkedIssues = inwardLinkedIssues.reverse();

ModifiedValue mVal;

MutableIssue clonedIssue;
MutableIssue clonedEpic;

try {
//Clone epic with all fields
def toClone = issueFactory.cloneIssueWithAllFields(issue)
clonedEpic = issueMgr.createIssueObject(issue.reporter, toClone) as MutableIssue

//set current system time as created date, otherwise it would have created date from source epic
// is deprecated but issueManager.updateIssue didn't work, don't know why

//Set new summary and epic name (same in this case)

mVal = new ModifiedValue(clonedEpic.getCustomFieldValue(epicName), newSummary);
epicName.updateValue(null, clonedEpic, mVal, new DefaultIssueChangeHolder());

//if source epic has outward links, clone each linked issue and set epic link to new epic
//For sub-tasks, this is unfortunately not working. Therefore they are excluded
clonedIssue = issueMgr.createIssueObject(issue.reporter, toClone) as MutableIssue


mVal = new ModifiedValue(clonedIssue.getCustomFieldValue(epicLink), clonedEpic);
epicLink.updateValue(null, clonedIssue, mVal, new DefaultIssueChangeHolder());

clonedIssue = issueMgr.createIssueObject(issue.reporter, toClone) as MutableIssue


mVal = new ModifiedValue(clonedIssue.getCustomFieldValue(epicLink), clonedEpic);
epicLink.updateValue(null, clonedIssue, mVal, new DefaultIssueChangeHolder());
return Response.serverError().entity([error: e.message]).build();

String BASE_URL = ComponentAccessor.getApplicationProperties().getString(APKeys.JIRA_BASEURL);

//show success message and load new epic - doesn't work in some cases, don't know why
String clonedMessage = """
Navigating to created issue <a href="${BASE_URL}/browse/${clonedEpic.getKey()}">${clonedEpic.getKey()}</a>...
function loadUrl(newLocation){
window.location.href = newLocation;

 Maybe not the best solution, but it is working for us. At least useful as a workaround until Atlassian maybe is providing such a function in the standard JIRA application in the future.


Can you please share the Custom Web Item configuration?


Getting below error while executing this code. Could you please help me in fixing this?

2019-01-25 10:36:38,866 ERROR [common.UserCustomScriptEndpoint]: *************************************************************************************
2019-01-25 10:36:38,873 ERROR [common.UserCustomScriptEndpoint]: Script endpoint failed on method: GET cloneEpicWithIssues
java.lang.NullPointerException: Cannot invoke method getId() on null object
 at Script5$_run_closure1.doCall(Script5.groovy:48)


here is a screenshot of the web item configuration.

I think you get the error message as you didn't provide the issue. In the configuration you do that in the "Link" field.



Hello Jonas,

Thanks for your reply.

I configured in the same way. But the issue is not created. Could you please help me with this? Is this something related to condition?



do you have a REST Endpoint configured that is called "showDialog"? It is called in the URL with the issue as parameter. It is defined in the first code snippet above. This dialog calls the second Endpoint if you click on "Submit" so it is necessary for this to work that both Endpoint exist.

Yes and No error though. When I click on Submit it is redirected to the same source issue and when I search for new epic, unable to find.RE.PNG

So, the log files don't show anything?

Then you maybe can add a logger to log some information on the issue creation or the new issue.

Hi @Jonas M 


Thank you for sharing the scripts of the solution if you can can you please share the scripted condition from the Custom Web Item also.




Hi Nikhil,

the condition is quite simple and displayed in the screenshot above:

issue.issueType?.name == 'Epic'



Like # people like this

Hi @Jonas M 

I was asking what are you trying to do with 

ApplicationUser appuser = ......


If you don't mind can you also paste.



Nikhil Guntupalli 

Hi @Nikhil

ok, understood.

The ApplicationUser appuser part was just an old script part which isn't used anymore. It was for testing purposes with checks the current user. But it isn't actually used anymore.

ApplicationUser appUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();

Best regards,


Hi @Jonas M 

Thanks for the help. Looks like its working for me in bits Please follow the attached screenshot and help me out.


Hi @Nikhil

ok, this seems like the screen just isn't displayed correctly.

Problem is that I can't really help here as we actually don't use this code for cloning epics with issues. We currently use the free app "Epic Clone" which is doing exactly the same.

So, maybe that would be an alternative for you as well.



Folks, if you have the latest version of the JIRA CLI installed (I have Atlassian CLI 8.0.0), then this command below will clone everything listed below:

  • the EPIC,
  • the issues under the EPIC,
  • the sub-tasks under the EPIC,
  • the sub-tasks under the issues under the EPIC,
  • as well as any other linked JIRA tasks 

jira --action cloneIssues --jql "project=ABC and 'Epic Link' = ABC-123 or IssueKey = ABC-123" --copySubtasks --copyLinks


Can you please share the custom web item configurations?

Hi Fred

But is the EPIC-Link also changed?

JQL: key = TEST-1756 OR "EPIC Link"= TEST-1756 ORDER BY issuetype ASC

The issues in the list are from different projects.

Then I do the Clone and select all the issues.

I select the following issues in the 3rd step:

  • Clone Subtasks
  • Clone Issue Links
  • Rebuild Issue Links
  • Rebuild Epic Link

Everything looks fine - except the Epic Link. This is still to the old Epic.

Yes, I noticed that that is the behavior for non-admins. When I ran it as an admin it copied the links correctly into the new EPIC. This is a serious detraction of the cloning tool, IMO.


This is EPIC CLONE free app and it worked perfectly. 

Epic Clone

by IJ-Solutionsfor Jira Server 7.6.0 - 8.2.3

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

How Unito's Newest Features Can Make Your Integrations Better

...ttachments another team sends over from Jira. Much easier for everyone involved. True sync for 100% of Trello native fields Trello is one of the most popular work management tools out there, and more Unito u...

54 views 0 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you