hi there.
have a ScriptRunner v.4.3.4 and JIRA 7.1.0. the task is to create a scheduled issues, one per week via Services.
I tried the code below,
import com.atlassian.jira.component.ComponentAccessor
def issueService = ComponentAccessor.issueService
def projectManager = ComponentAccessor.projectManager
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def constantsManager = ComponentAccessor.getConstantsManager()
def issueType = constantsManager.getAllIssueTypeObjects().find {it.name.equalsIgnoreCase("Incident")}
def issueInputParameters = issueService.newIssueInputParameters()
issueInputParameters.with {
projectId = projectManager.getProjectObjByKey("SD").id
summary = "Scheduled Issue"
issueTypeId = issueType.getId()
reporterId = "admin"
}
def validationResult = issueService.validateCreate(user, issueInputParameters)
assert !validationResult.errorCollection.hasAnyErrors()
def issueResult = issueService.create(user, validationResult)
log.info "Issue created: ${issueResult.issue}"
return "Issue created: ${issueResult.issue}"but if paste it in Script Console, the result is
Issue created: null
can anyone explain me how to make it work?