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)
}