script validator - fixversion

Hi, I'm trying to add a validator on an existing transition.

"If the Fixversion field has no value, user should get a message "fix version must have a value", and is not allowed to transmit untill fixversion has a value"

I've tried this with custom fields - cfvalues['somefield'] - and this works for custum fields, but not for the field fixversion

Any ideas ?

6 answers

1 accepted

you can try something like this

def fixVersion= issue.getFixVersions();
 if (fixVersion == null) {
//throw error message here

1 vote

You can use the "simple scripted validator" where the condition should just be:


Let groovy worry about whether it's null or an empty collection or whatever.

Hi, tried this - error message is thrown every time...even if fixversion has a value.

But I tried only:

def fixVersion= issue.getFixVersions()

This resolved my problem

Thank's :-)

glad to hear it worked!!

Hi Arild,

You must add your .groovy script as validator for your transition.

You can use these codes as groovy workflow validator script

import java.util.ArrayList;
import java.util.Collection;
import com.atlassian.jira.config.ConstantsManager;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.project.version.Version;
import com.opensymphony.workflow.InvalidInputException;

Collection<Version> fixVersions = new ArrayList<Version>();
	fixVersions = issue.getFixVersions();
	if(fixVersions.size() == 0)
		invalidInputException = new InvalidInputException("fixVersions","Fix Versions field can not be empty.");

def fixVersion= issue.getFixVersions()

This resolved my problem

Thank's :-)

0 vote
Mizan Community Champion Oct 10, 2013

There is a field required validator provided by suite utilities plugin which you can use.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,183 views 13 19
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
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