Validation
Validated transition is executed or cancelled based on logic contained in your Groovy Script.
In order to cancel a transition, validator needs to throw an exception. Otherwise, transition will be executed.
Throwing an exception:
JIRA Transition Validators use InvalidInputException class to throw exception when transition needs to be cancelled. You need to import said class first in order for your script to work properly. This can be done by inserting the following line into your script:
Now that the class is imported, you have to make your code throw an exception. It's done by creating a new InvalidInputException object with following code:
where "field-name" is the name of the field you want the message to appear under and "Error message" is the message text you want to appear.
Field names of all default Issue Fields can be found here. Custom Fields need to be indicated by their Custom Field ID.