You can now vote for scripts to help people know if they're useful or not. Login or create an account to vote!


Copy an Issue to a New Project and Link to the Original


Copy an issue from one project to another. Either copy the entire issue or the parts of the issue required.


My team has multiple projects in Jira, a main project and several client projects, each with their own product owners and dashboards. Issues are created in the main project; however, one of my colleagues found the same issue in their client project. Using this snippet they can copy this issue over to their project.

Good to Know

  • This script links the source and copy issues together, but there is a similar script that does not do it.
  • Copy this snippet into a listener, post function, or other features of ScriptRunner for Jira.


  • Jira Jira (8.0 - 8.14)
  • ScriptRunner for Jira ScriptRunner for Jira (6.18.0)
import com.atlassian.jira.component.ComponentAccessor import import com.onresolve.scriptrunner.canned.jira.utils.AbstractCloneIssue import com.onresolve.scriptrunner.canned.jira.utils.CannedScriptUtils import com.onresolve.scriptrunner.canned.jira.utils.ConditionUtils import com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.CloneIssue import com.onresolve.scriptrunner.runner.ScriptRunnerImpl import groovy.xml.MarkupBuilder def targetProjectKey = "PROJB" def issueToCloneKey = "PROJA-1" def issueToClone = ComponentAccessor.issueManager.getIssueByCurrentKey(issueToCloneKey) def linkBetweenIssues = CannedScriptUtils.getAllLinkTypesWithInwards(true).find { it.value == "blocks" }?.key?.toString() // Set the creation parameters/inputs (use clone issue with link type) def params = [ (CloneIssue.FIELD_TARGET_PROJECT) : targetProjectKey, (CloneIssue.FIELD_TARGET_ISSUE_TYPE) : null, (CloneIssue.FIELD_COPY_FIELDS) : AbstractCloneIssue.COPY_ALL_FIELDS, (CloneIssue.FIELD_SELECTED_FIELDS) : null, (CloneIssue.FIELD_COPY_COMMENTS) : false, (CloneIssue.FIELD_USER_KEY) : null, (ConditionUtils.FIELD_ADDITIONAL_SCRIPT): ["", ""], (CloneIssue.FIELD_LINK_TYPE) : linkBetweenIssues ] as Map def executionContext = [issue: issueToClone] as Map def cloneIssueAction = ScriptRunnerImpl.scriptRunner.createBean(CloneIssue) // Execute the clone action with the specified params def updatedExecutionContext = cloneIssueAction.execute(params, executionContext) // Return the link to the cloned issue cloneIssueAction ? "Cloned issue: ${createHrefLinkToIssue(updatedExecutionContext.newIssue as String)}" : "Could not clone issue, check the logs for errors" static String createHrefLinkToIssue(String issueKey) { def baseUrl = ComponentAccessor.applicationProperties.getString(APKeys.JIRA_BASEURL) def writer = new StringWriter() def html = new MarkupBuilder(writer) html.html { a href: "$baseUrl/browse/$issueKey", issueKey } writer }
Discovered an issue? Report it here

Suggested for you