The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I implemented a script runner post action that was intended to transition all subtasks.
The script works fine, but fails for some subtasks. After investigation I find that those issues are commented or has previously been commented by a user that was deleted from the system.
Yes I know users should not be deleted, but this seems to be one of those manual mistakes that happens in a large organization.
After recreating the user the script runs fine.
But I don't understand why the validator prevents transition because of an old comment?
Manual transition does not care?
import com.atlassian.jira.component.ComponentAccessor def issueService = ComponentAccessor.getIssueService() def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() def subTasks = issue.getSubTaskObjects() subTasks.each { if (it.statusObject.name == "Open") { def issueInputParameters = issueService.newIssueInputParameters() issueInputParameters.with { setSkipScreenCheck(true) } // validate and transition subtask
def validationResult = issueService.validateTransition(user, it.id, 21, issueInputParameters) if (validationResult.isValid()) { def issueResult = issueService.transition(user, validationResult) if (!issueResult.isValid()) { log.warn("Failed to transition subtask ${it.key}, errors: ${issueResult.errorCollection}") } } else { log.warn("Could not transition subtask ${it.key}, errors: ${validationResult.errorCollection}") } } }
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events