While trying to transition an issue with a listener on Issue Created event getting error:
Errors: {}
Error Messages: [It seems that you have tried to perform a workflow operation (gateway - to do --> to verify) that is not valid for the current state of this issue (QA-109070). The likely cause is that somebody has changed the issue recently, please look at the issue history for details.]Works perfectly fine on the same transition after issue is created. User has enough permissions to do it manually as well. Here's the code:
void execTransition(ApplicationUser currentUser, Issue issue, int transId){
def issueService = ComponentAccessor.getIssueService()
IssueInputParameters issueInputParameters = new IssueInputParametersImpl()
issueInputParameters.setSkipScreenCheck(true)
TransitionOptions transitionOptions = new TransitionOptions.Builder().skipConditions().skipPermissions().skipValidators().build()
def transitionValidationResult = issueService.validateTransition(currentUser, issue.id, transId, issueInputParameters, transitionOptions)
if (transitionValidationResult.isValid()) {
IssueService.IssueResult trans = issueService.transition(currentUser, transitionValidationResult)
if(!trans.isValid()){
log.warn "Transition invalid"
trans.errorCollection.each {err ->
err.getErrorMessages().each {err1 ->
log.error err1.getProperties()
}
}
}
} else {
log.warn "Validation invalid"
transitionValidationResult.errorCollection.each {err ->
log.error err
}
}
} I saw Jamie's comment here but I still need to do it in listener