IssueService.IssueResult transition doesn't modify the status of the issue after a specified transition

Hi Atlassians,

Inside my postfunction, I'm using IssueService.IssueResult transition method in order to transition an issue through workflow.

As specified in the documentation, the issue will be saved and re-indexed and the transition will be made.(, com.atlassian.jira.bc.issue.IssueService.TransitionValidationResult) ).

As I understand from that, there is no need to update the issue by code as this method will do it.

In my code, I noticed that the transition is happening (by checking History tab) but the issue is not saved (Status is not modified). I used to put issueManager.updateIssue (kindly ckeck highlighted line in the below code) after it in order to force updating the issue.

My question is: Why implementing IssueService.IssueResult transition is not enough to save the issue after transitioning it?

My code is the following:

TransitionValidationResult transitionValidRes = issueService.validateTransition(authenticationContext.getUser().getDirectoryUser(),issue.getId(),configAction.getId(), issueInputParameters);

log.debug("Current Status of the issue: " + issue.getStatusObject().getName());

log.debug("Action ID: " + configAction.getId());

if (!transitionValidRes.isValid())


Iterator<String> ite = transitionValidRes.getErrorCollection().getErrorMessages().iterator();

StringBuilder sb = new StringBuilder();

while (ite.hasNext())





throw new Exception(sb.toString());


ErrorCollection transitionErrorCollection = issueService.transition(authenticationContext.getUser().getDirectoryUser(), transitionValidRes).getErrorCollection();

if (transitionErrorCollection.hasAnyErrors())






log.debug("New Status of Issue: " + transitionValidRes.getIssue().getStatusObject().getName());



issueManager.updateIssue(authenticationContext.getUser().getDirectoryUser(), issue, EventDispatchOption.ISSUE_UPDATED, false);



4 answers

0 votes

Generally, trying to transition an issue while another transition is still executing does not work.

What you've got there would probably work fine in a listener, but I've never seen it work in a post-function (in fact, had jobs cleaning up the mess made by people trying to do this)

I do know it can be done - the script runner and jjupin plugins appear to be doing a transition in a post-function, but it's really not as simple as just trying to kick off a new transition using the issue service (I know at least one of those plugins is effectively starting the transtion after the first one ends),

Thanks Nic.

However, when I checked the code inside Fast Track Script Runner, I noticed that the same method is being used: issueService.transition


public static Issue actionIssue(String additionalScript, MutableIssue theIssue, Integer actionId, User user, Map scriptParams = [:]) {

IssueService issueService = ComponentAccessor.getIssueService()

IssueInputParameters issueInputParameters = new IssueInputParametersImpl([:])

scriptParams.put("issueInputParameters", issueInputParameters)

ConditionUtils.doAdditional(additionalScript, theIssue, scriptParams)

issueInputParameters = scriptParams['issueInputParameters'] as IssueInputParameters

def validationResult = issueService.validateTransition(user,, actionId as Integer, issueInputParameters)

ErrorCollection errorCollection = validationResult.errorCollection

if (errorCollection.hasAnyErrors()) {

// We used to carry on because sometimes these seem spurious. More investigation needed.

log.error (errorCollection)

log.error ("Not attmpting transition")

return null


errorCollection = issueService.transition(user, validationResult).errorCollection

if (errorCollection.hasAnyErrors()) {

log.error (errorCollection)


else { ("Transitioned issue $theIssue through action \"$actionId\"")


// reload issue

theIssue = ComponentAccessor.getIssueManager().getIssueObject(

Status finalStatus = theIssue.statusObject

log.debug "Final status: ${finalStatus.getName()} (${})"





I have the same question. I have been struggling to get this to work, without success, as a listener for a couple of days now sad

It works by running transition in a new thread from a listener script.

// your groovy code to run transition


If you want to run this at the "issue created" step, you will need to apply an additional tricks to check the workflow is fully initialized before runing your transition:

workflowEntries = ComponentAccessor.getOfBizDelegator().findByAnd("OSWorkflowEntry","id", issueObject.getWorkflowId()))
workflowState = workflowEntries[0].get("state")

workflowState must be equal to 1 in order to apply any transition.
You might need to do a "while" loop to wait for the workflow state to change from 0 to 1. (few millisec)


Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,302 views 12 19
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you