Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Where can I find some examples to define a script validator using script runner?


I need to define a script validator and I have no experience on it. Where can I find examples or manuals to do that?

Thanks in advance



5 answers

Not sure if is that what you are looking for, but there is a few examples in the link below:


Following these examples I've witten a script groovy only with the following code:


import com.opensymphony.workflow.InvalidInputException
import org.apache.log4j.Category"START - VALIDATOR"); 
log = Category.getInstance("com.onresolve.jira.groovy.example.testValidator")
invalidInputException = new InvalidInputException("Validation failure")"END - VALIDATOR");


I've defined a Validation "Script validator" in "Create" action where this script is invoked but when I launch "create issue" I can create issues with any problem. 

I'm sure I haven't understood how Script validators works...... any help?

Thanks in advance



It's almost identical to the simple example in the link Teilor and me provided. Honestly, I don't see why it is not working.

Hi, sorry was in holiday. Your script seems to be ok to me. Did you find any errors in the log file ? Did you find the logging info ?

Of course depends how complex the validations are, but here a simple example (for issue type 'Bug' the field AffectedVersion should be filled:

import com.atlassian.jira.issue.Issue 
import com.opensymphony.workflow.InvalidInputException
Issue myIssue = issue
if (myIssue.getIssueTypeObject().getName() == "Bug") { 
	if (! myIssue.getAffectedVersions().size()) { 
		invalidInputException = new InvalidInputException("versions", "Affects Version/s is required in this context.")     

Hi @Marc Minten (EVS), 
I need help with something similar as well.

I have a workflow with multiple projects in it.
I want to make a field required in one of the Projects. (lets say ABC)

I want to make the Sprint field required in this project ABC when the user moves the issue from "Submitted to Assigned" state.

I've tried doing it by modifying your code but it's not working.
Could you help me out?
I'd appreciate the help. Many thanks.  

Suggest an answer

Log in or Sign up to answer

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you