Issue Transitioning oddity

I am trying to transition issues through the workflow using the code below as a workflow POST function.  When the script executes it appears to run fine with no errors.  The workflow buttons on the top are updated with the correct destination transitions but, the status of the workflow shows the original destination and not the correct one it transitioned to.

Any Assistance would be appreciated.



log = Category.getInstance("com.verizon.jira.groovy")

MutableIssue issue = issue

Status initialStatus = issue.statusObject

log.warn("Starting ARS_CheckForDomestic.groovy (ID: " + issue.key.toString() + ")");
def indexManager = ComponentAccessor.getIssueIndexManager()

CustomFieldManager customFieldManager = ComponentManager.getInstance().getCustomFieldManager();

CustomField cfLocation =  customFieldManager.getCustomFieldObjectByName( "Location" );
String cfvLocation = issue.getCustomFieldValue(cfLocation);

if (cfvLocation == "Domestic (USA, CA)") {
    User user = ComponentManager.getInstance().getUserUtil().getUser('system');

    IssueService issueService = ComponentManager.getComponentInstanceOfType(IssueService.class)
    IssueInputParameters issueInputParameters = new IssueInputParametersImpl([:])

    issueInputParameters.setStatusId("Pending Approval")
    IssueService.TransitionValidationResult validationResult = issueService.validateTransition(user,, 91 as Integer, issueInputParameters)
    def errorCollection = validationResult.errorCollection
    if (! errorCollection.hasAnyErrors()) {
        issueService.transition(user, validationResult)
    else {
        log.warn("Error transitioning issue.")


log.warn("Completed ARS_CheckForDomestic.groovy (ID: " + issue.key.toString() + ")");

2 answers

This is not at all straightforward. The database commit is not done until the first transition finishes, and you end up with a mishmash of two different states with your approach.

You should try the built-in fast-track script. Everything above your "if" can go in the Condition, the issueInputParameters stuff you pass in the "additional code" section.

I started out with a listener with the following:


Project: Target Project

Events:  Issue Updated

Condition:  issue.status == 'Pending Missing VZID Approval' && cfValues['Location'] == 'Domestic (USA, CA)'

Action:  Target Transition.


This resulted in no transition.  I went so far as to remove the Condition and still was not getting transitioned.





Your condition is not right, but what is this for, fast-track? Have you decided to use the built-in script? The first part should be: == ... If Location is a select list you should use: cfValues['Location']?.value == "Domestic ..."

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Wednesday in Marketplace Apps

Marketplace Spotlight: Marketing apps for Confluence to keep your teams working on the same page


116 views 0 3
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