Skip to main content
Book your demo
Example scripts
To homepage
Jira
Cloud icon
Cloud

Clone a Work Item and Link To It

Created 2 year(s) ago, Updated 0 day(s) ago
App in script
ScriptRunner For Jira
ScriptRunner For Jira
by Adaptavist
Compatibility
compatibility bullet
Jira
Language |
groovy
def workItemKey = 'WorkItemKeyHere'

def sourceWorkItem = WorkItems.getByKey(workItemKey)

def space = sourceWorkItem.getSpaceObject()

def workType = sourceWorkItem.getWorkType()

def clonedWorkItem = WorkItems.create(space.key, workType.name) {
    summary = sourceWorkItem.summary
    description = sourceWorkItem.description
}

// Change link type name below if you do not want to use the clones link type
clonedWorkItem.link("clones", sourceWorkItem)
Having an issue with this script?
Report it here