When transitioning an issue in the post function with issueService.transition, the destination status (let's call it status2) is not set.
BTW, the post function is the last function on the post function list.
I am using JIRA 7.2.6 software and ScriptRunner 4.3.1.
Did anyone see any problem similar? Any suggestions will be highly appreciated.
Your code seems to be valid. There are two strange places: {} after try block instead { and line
issueInputParameters.setSkipScreenCheck(true)
I also refactored your code a little
import com.atlassian.jira.bc.issue.IssueService import com.atlassian.jira.user.ApplicationUser IssueService issueService = ComponentAccessor.getIssueService() ApplicationUser user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() def workflow = ComponentAccessor.getWorkflowManager().getWorkflow(issue) log.info("Found workflow " + workflow.getDisplayName()) List<ActionDescriptor> oActions = workflow.getLinkedStep(issue.getStatus()).getActions(); log.info("Found " + oActions.size() + " actions for " + workflow.getDisplayName()) try{ for (ActionDescriptor oAction : oActions) { log.info("Checking " + oAction.getName()) if (oAction.getName().equalsIgnoreCase("from status1 to status2")) { // validate and transition subtask def IssueInputParameters issueInputParameters = issueService.newIssueInputParameters() //is this line requared? issueInputParameters.setSkipScreenCheck(true) issueInputParameters.setComment("Testing comment") def validationResult = issueService.validateTransition(user, issue.getId(), oAction.getId(), issueInputParameters) if (validationResult.isValid()) { IssueService.IssueResult issueResult = issueService.transition(user, validationResult) if (!issueResult.isValid()) { log.warn("Failed to transition issue ${issue.key}, errors: ${issueResult.errorCollection}") } log.info("Successfully transition issue ${issue.key}, triggered by ${issue.id}") } else { String message = "Could not transition issue ${issue.key}, errors: ${validationResult.errorCollection}" log.warn(message) //The retry logic will pick up the exception throw new RuntimeException(message) } break; } } }catch(Throwable t){ def message = "Failed to transition issue ${issue.key}" log.error(message) }
I got the same problem and I solve it an other way
I put auto transition in the workflow (export workflow to xml, modify xml and import it)
sample in the xml : <action id="31" name="toNextPhase" auto="true">
and I control the transition by condition in the workflow
I wish this can help
an other post for auto transition Here
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
I have the same issue. Any news about it?
Thanks in advance
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, it is long time ago and I don't remember what was the exact solution but I don't see such problem anymore. I changed my database isolation level from read_committed to read_committed_snapshot and it solved a lot of weird problems but I don't remember this is one of the them or not.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for looking at this. My code is
def expectedTransitionName="from status1 to status2" def issueService = ComponentAccessor.getIssueService() def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() def workflow = ComponentAccessor.getWorkflowManager().getWorkflow(issue) log.info("Found workflow " + workflow.getDisplayName()) StepDescriptor oStep = workflow.getLinkedStep(issue.getStatus()); List<ActionDescriptor> oActions = oStep.getActions(); log.info("Found " + oActions.size() + " actions for " + workflow.getDisplayName()) try{} for (ActionDescriptor oAction : oActions) { log.info("Checking " + oAction.getName()) if (oAction.getName().equalsIgnoreCase(expectedTransitionName)) { // validate and transition subtask def IssueInputParameters issueInputParameters = issueService.newIssueInputParameters() issueInputParameters.setSkipScreenCheck(true) issueInputParameters.setComment("Testing comment") def validationResult = issueService.validateTransition(user, issue.getId(), oAction.getId(), issueInputParameters) if (validationResult.isValid()) { def issueResult = issueService.transition(user, validationResult) if (!issueResult.isValid()) { log.warn("Failed to transition issue ${issue.key}, errors: ${issueResult.errorCollection}") } log.info("Successfully transition issue ${issue.key}, triggered by ${issue.id}") } else { def message = "Could not transition issue ${issue.key}, errors: ${validationResult.errorCollection}" log.warn(message) //The retry logic will pick up the exception throw new RuntimeException(message) } break; } } }catch(Throwable t){ def message = "Failed to transition issue ${issue.key}" log.error(message) }
With the code, I am able to see the log output of "Successfully transition issue ${issue.key}, triggered by ${issue.id}". However the JIRA UI and the jiraissue table don't set the status to status2 ad described in my original question.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you provide your code?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.