Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Proper way to use JMWE Validators with select list custom field


Hello. I'm trying to do the following using JIRA Misc workflow extensions (JMWE) validators as a bit of an approval process. Basically if a field (10059, multi select list) is NOT set to None (which is the default no value for this field by JIRA). Then it needs to have one of the few people in the select list (10057) to pass validation.  Here is the basic expression that I thought  would work:


!!issue.customfield_10059 && issue.customfield_10059.some(it => it.value != "None") &&
!!issue.customfield_10057 && issue.customfield_10057.value == "a value in the list"


I tried the inverse of some of the logic above, but I cant see to get it work. It seems to always through the validation error, or never throw it. I'm pretty sure I' missing something simple, but I'm new to these type of expressions. 


As a bonus, it'd be nice to allow for a few values out of the list in 10057 allow it to pass validation (it'd be 3 names out 10 in that list. Something like  10057.value.containts("Approver 1", "Approver 2", "approver 3"). 

1 comment

Hi @Daniel Burris 

First of all, is "None" an actual option you have configured on your multi-select field, or does it denote that no value is selected? I assume the latter.

In that case, the internal value of the field is... null. 

Then the problem is with your logic. The Build-your-own validator should pass if either customfield_10059 is empty or (if it isn't empty) customfield_10057 has a desired value. So the code should be:

!issue.customfield_10059 || !!issue.customfield_10057 && issue.customfield_10057.value == "a value in the list"

 And for multiple acceptable values:

!issue.customfield_10059 || !!issue.customfield_10057 && ["val1","val2","val3"].includes(issue.customfield_10057.value)
Like Dillon likes this


Log in or Sign up to comment