Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How can I run a transition's validators before making the transition in code?


I'm trying to conditionally trigger a transition on linked issues as a post function, which is close to working, except that when the linked issue's transition validator fails, the transition that triggered the post function then fails as well, which I don't want. I'd like to skip the linked issue transition in that case, requiring it to be manual. This is what my code looks like:

def transitionValidationResult = issueService.validateTransition(
new IssueInputParametersImpl()

if (!transitionValidationResult.isValid()) {
log.error("'${actionName}' transition is not valid for ${linkedTicket.key}: ${transitionValidationResult.errorCollection}")
} else {"Transitioning...")

def transitionResult = issueService.transition(ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser(), transitionValidationResult)

if (!transitionResult.isValid()) {
log.error("Failed to transition ${releaseTicket.key}: ${transitionResult.errorCollection}")

It seems like the validateTransition() call should return an invalid result, but then the actual transition fails. Am I missing something? Once the actual transition fails, it then automatically rolls back the original transition the user initiated. 

UPDATE It's been a few weeks since I asked this - does anyone out there have any ideas?

1 answer

Seems like a bug in issueService. :-(

I have excactly the same problem. Here is the sample for test from Console:

import com.atlassian.jira.bc.issue.IssueService
import com.atlassian.jira.component.ComponentAccessor as CA
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueInputParameters
import com.atlassian.jira.user.ApplicationUser
import org.apache.log4j.Level
import org.apache.log4j.Logger

def ACTION_ID = 131
Issue issue = CA.getIssueManager().getIssueObject("B2-3082")
ApplicationUser user = CA.jiraAuthenticationContext.loggedInUser

IssueInputParameters issueParams = CA.issueService.newIssueInputParameters()
IssueService.TransitionValidationResult validationResult = CA.issueService.validateTransition(user,, ACTION_ID, issueParams) "validationResult: ${validationResult.isValid()} errors: ${validationResult.errorCollection.errors}"

if (validationResult.isValid()) {
def transitionResult = CA.issueService.transition(user, validationResult)
if (!transitionResult.isValid()) {
log.warn "Failed to transition issue ${issue.key}, errors: ${transitionResult.errorCollection.getErrorMessages()}"
} else { "Sussessful transition issue ${issue.key}"
} else {
log.warn 'Errors on validation:'
log.warn validationResult.errorCollection.errors
log.warn validationResult.warningCollection.warnings

2021-11-25 10:32:55,554 INFO [runner.ScriptBindingsManager]: validationResult: true errors: [:] 2021-11-25 10:32:55,672 WARN [runner.ScriptBindingsManager]: Failed to transition issue B2-3082, errors: [Comment: Please provide a comment for this transition]

Have you resolved this issue?

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events