Jira transition in a workflow

Hi, I have a small query.

I have a post function script in a workflow transition according to which if that script executes successfully and an output is gained then transition from A->B goes through successfully. If not, then it stays at A.

Is is possible?

1 answer


you might want to do it with a validator (or a condition), but not with a post-function smile


If it's a post-function, it's too late, the transition is almost complete

If it's a validator, then yes, you can return a pass or fail

You do NOT want a condition.  It will be run every time JIRA looks at the issue to see if a user can use it.

Hi NIc,

Thanks for the confirmation. How can I implement the same through a validator. I will try to explain the whole scenario:

I have a groovy script, which shoots a curl command to Service Now, and gives an output in my JIRA logs. Based on that output, i want to make sure that the transition goes from A->B or stays at A.

My approach:

I have a custom field which gets populated in my JIRA ticket screen with the result of the grovy script mentioned above. So my requirement is, if custom field gets populated with value X then A->B should take place, if not(e.g. value Y) then transition stays at A.


You will need to embed your script in a validator. 

Are you using the script runner add-on?  If not, then you're going to need to write a validator that can run your connection and interpret the result as a pass/fail.

Hi Nic, I am using this scriplet in my Validator, but still not working, can you pls suggest:


log.debug("Inside incident block");
//def servicenowid = customFieldManager2.getCustomFieldObjectByName("ServiceNow ID");
//log.debug("Service id=$servicenowid")
log.debug("Inside incident block");
workflowTransitionUtil.setAction (1531);//Transition B
log.debug("Inside Else block");
issue.setCustomFieldValue(servicenowidfield,"Not Created in Service Now");
workflowTransitionUtil.setAction (4);//Transition A


How can I optimize this script to the above condition?


As of now, my script is anyways going to B irrespective of the fact that it catches the else block only.


No, hang on, that's not what we were discussing.

You do NOT try to change the target of a transition while it's running.  And there's absolutely no way you should be even thinking of changing an issue in a validator.

A validator should validate something, returning "true" if it's ok, and "false" (with an optional error message) if it fails validation.

Suggest an answer

Log in or Join to answer
Community showcase
Alexey Matveev
Published Saturday in Jira

How to run Jira in a docker container

Everything below is tested on Ubuntu 17.10. I prefer to use Jira in a docker container because: 1. I can install Jira with a couple of commands. 2. I can start and stop Jira just by starting and s...

495 views 6 8
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot