Hello everyone. I have a part of code to "copy issue" to another queue and I want to link the following issue. How to do that (I can't even get new issue id from another project)
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
def PROJECT_KEY_TO = "SOME PROJECT"
def issueManager = ComponentAccessor.getIssueManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def issueFactory = ComponentAccessor.getIssueFactory()
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def projectTo = ComponentAccessor.getProjectManager().getProjectByCurrentKey(PROJECT_KEY_TO)
if (issue.summary.contains("*some summary*") {
def newIssue = issueFactory.cloneIssue(issue)
newIssue.setProjectObject(projectTo)
Map <String,Object> newIssueParams = ["issue":newIssue] as Map<String,Object>
Issue storageIssue = issueManager.createIssueObject(user, newIssueParams)
log.error(storageIssue.id)
}
What are you trying to achieve exactly? You can clone an issue without coding.
Best,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.