HI all,
I'm trying to create so many issues as many components were selected.
If I select components a, b, c. So I would like to create 1st issue with component a, 2nd with component b and so on.
This is my code, it doesn't work and also in log is only 'null' value. I'm lost.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
Issue issue = issue
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
int i = 0
def issueSummary = issue.summary
def issueDescription = issue.description
def issueReporter = issue.reporter
def issueTypeId = issue.issueTypeId
def components = issue.components.toList()
components?.each {
def issueFactory = ComponentAccessor.getIssueFactory()
def issueManager = ComponentAccessor.getIssueManager()
def newIssue = issueFactory.cloneIssue(issue)
newIssue.setIssueTypeId(issueTypeId)
newIssue.setSummary(issueSummary)
newIssue.setDescription(issueDescription)
newIssue.setReporter(issueReporter)
newIssue.setComponent(components)
Map<String,Object> newIssueParams = ["issue":newIssue] as Map<String,Object>
issueManager.createIssueObject(currentUser, newIssueParams)
}
Any help?
Thanks in advance.
KR
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.