Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

[ScriptRunner Listener - Clone Issue Using listener or Jobs ]

Aymen Jebri
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!
May 7, 2020

Hi,

I am trying to figure out if there is a way to clone an issue via listener or jobs using script runner.
I am using the code below but I am  getting an error message saying that there is a problem with the workflow.

I am  getting an error message with this line :  new CloneIssue().doScript(params)
saying :
cannot find matching method : com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.CloneIssue

From my understanding I cannot clone an issue using a listener or jobs.
Am I wrong in assuming that? & is there any solution or other approach 

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.project.Project
import com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.CloneIssue

def issueManager = ComponentAccessor.getIssueManager()
def originalIssueKey = issueManager.getIssueByCurrentKey("ATG-1")
def destinationProjectKey = ComponentAccessor.projectManager.getProjectObjByKey("ATG")

cloneIssue(originalIssueKey, destinationProjectKey)

void cloneIssue (MutableIssue issue, Project project) {
def params = [
issue : issue,
(CloneIssue.FIELD_TARGET_PROJECT) : project.key,
(CloneIssue.FIELD_SELECTED_FIELDS) : null, //clone all the fields
] as Map<String, Object>

new CloneIssue().doScript(params)
}

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events