How/In What Order does ScriptRunner parse validators?

Hello,

I am a non-programmer currently writing scripts for my company's JIRA processes using ScriptRunner. 

I have a number of Validators on a transition from one issue state to another. Originally, I thought they executed in order, so I put the most general validator on top, and other validators that check for specific issue types in if statements below them. I then realized that error codes for these simple script validators below the general ones were showing up instead of the topmost validator, which should be catching those issues.

I added an if statement that ORs all the issue types involved, and this solved the problem, but I'm afraid I don't understand how or why this works.

How do ScriptRunner Validators execute? Does it go by issue, or does the shortest loop execute first?

Thanks

1 answer

1 accepted

This widget could not be displayed.

Validators run when a user clicks either the transition button (assuming no screen is there) or the "complete transition" button on a transition screen. 

They run in the order you add them to the workflow transition.  Oddly, it does still run all of them, even if the first one fails, but it's easiest to think of it running the lot and reporting the first problem.

Okay, so they all run. I was wondering if that was the case when validators below the one I intended to execute were running. I guess with the if statement my script catches all the cases and prevents the other scripts from throwing errors first.

Thank you

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

143 views 2 0
Join discussion

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