How do I make the second field of a cascading select field required?

If a cascading select field is set to required, only the first selection field is actually required. The second field can be left unselected. How do I make both fields required? I found this:

cfValues["myCascadingSelect"]?.getKeysAndValues()?.size() == 2

but have been unsuccessful in getting it to work as a validation on the create transition.
We are running JIRA v5.2.5

2 answers

1 accepted

0 vote
Daryl Chuah Atlassian Team Feb 05, 2013

Hi there

There is a similar question regarding on this posted before, perhaps you can refer on this as a general guideline and reference :

Hope it helps :)


cfValues['your cascading field']?.values()*.value.size() == 2
This one is working for me.

Hi Where do I have to write that code?

You need to install script runner plugin firstly, Then use Script Validator to add the code

I tried it in a workflow transition validator (using the option 'Simple scripted validator') and it does not seem to work.

I read in another post that since Jira 5.x, the values are returned as a map, so they suggested this check:

   cfValues.get("customfield_17637")?.keySet()?.size() == 2

but it does not work for me (meaning when I put a not-None value, it still fails).


Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

149 views 1 17
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