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

JMWE Validation for checking Single select List option Edited

Im trying to write a validation where is checks to see if the option "Other" is selected in the single selection list called test type list (cf_10619).  if option "other" is selected then test Type "Other" (cf_10620) is required, otherwise it is not required. 

So far i have tried the below - but this just returns a boolean that something has been selected from the the test type list (cf_10619) and that test type other (cf_10620) is not empty.

No matter which selection is made, this always requires Test Type "other" to be required

issue.customfield_10619.value == "Other" && !! issue.customfield_10620

 using JWME and unfortunately im not a developer so im sure this is the basics of JS development that i do not know. 

Any help would be greatly appreciated. 

1 answer

1 accepted

0 votes
Answer accepted

After playing with this for a little i was able to get this to work by using the below code.  if anyone knows are more elegent way to do this, please let me know.

Code that worked:

issue.customfield_10619.value != "Other" || ( issue.customfield_10619.value == "Other" && !! issue.customfield_10620 )

Hi Julian,

you can actually simplify your expression this way:

issue.customfield_10619.value != "Other" || !! issue.customfield_10620

because if the first part of the expression is false, it means that issue.customfield_10619.value == "Other" so you don't have to test it again.

Thanks David, that simplified it a lot actually.  Thanks for the explanation as well!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

The add-in you’ve been waiting for: Jira Cloud for Excel 🙌

Introducing Jira Cloud for Excel Here at the product integrations team at Atlassian, we are thrilled to announce the new Jira Cloud for Excel add-in! This add-in lets you export Jira data directly ...

841 views 5 22
Read article

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