I run this script in the Script Console.
I am trying to set status for issue. I use "issueService.transition()" method for this purpose.
The full code looks like this:
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.bc.issue.IssueService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueInputParametersImpl
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.search.SearchProvider
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.web.bean.PagerFilter
import com.atlassian.jira.issue.IssueManager
import org.apache.log4j.Logger
import org.apache.log4j.Level
def log = Logger.getLogger("com.acme.ListLinks")
log.setLevel(Level.DEBUG)
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def issueManager = ComponentAccessor.issueManager
def issue = ComponentAccessor.getIssueManager().getIssueObject("EL-115")
def workflowManager = ComponentAccessor.getWorkflowManager()
def workflow = workflowManager.getWorkflow(issue);
def testTransitionId = 11;
def issueService = ComponentAccessor.getIssueService();
def issueInputParameters = issueService.newIssueInputParameters();
IssueService.TransitionValidationResult validationResult = issueService.validateTransition(currentUser, issue.id, testTransitionId as Integer, new IssueInputParametersImpl())
def errorCollection = validationResult.errorCollection
log.debug('transition section:')
if (! errorCollection.hasAnyErrors()) {
log.debug('transition section. Successful')
issueService.transition(currentUser, validationResult)
}
else {
log.debug('transition section. Something wrong here')
log.error(errorCollection)
}
However, I see the following error:
2018-06-08 18:15:04,294 ERROR [acme.ListLinks]: Errors: {}
Error Messages: [It seems that you have tried to perform a workflow operation (Test status) that is not valid for the current state of this issue (EL-115).
The likely cause is that somebody has changed the issue recently, please look at the issue history for details.]
Guys, what I can do to solve this error or how can set another status for issue using ScriptRunner?
My Workflow looks like this:
