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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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
4,557,783
Community Members
 
Community Events
184
Community Groups

Proper way to use JMWE Validators with select list custom field

Edited

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"). 

4 answers

Hi @David Fischer _Appfire_ , Many thanks as always, it worked perfectly, Kudos to you.

Regards,

Ajay

1 vote
David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jan 30, 2023

Hi @Atlassian Learner 

it's similar to what I shared earlier:

!!issue.customfield_10000 || 
!!issue.customfield_10010 && !["N/A","No"].includes(issue.customfield_10010.value)
&& !!issue.customfield_10011 && !["N/A","No"].includes(issue.customfield_10011.value)
&& !!issue.customfield_10012 && !["N/A","No"].includes(issue.customfield_10012.value)
&& !!issue.customfield_10013 && !["N/A","No"].includes(issue.customfield_10013.value)

where  customfield_10000 is the ID of the Reason field, and customfield_10010...customfield_10013 are the IDs of the four dropdown fields.

1 vote
David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jun 14, 2021

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)

Hi @David Fischer _Appfire_ , Seems you are every were for the JMWE logics.

Can you please help me here, we have four dropdown fields with values Yes, No ,  N/A, other and have a text field with name Reason.

Here when ever the field Reason is null(Empty) then the values of the four fields ( Field 1, field 2, field 3 , field 4 ) values should not be equal to N/A or No.

Can you please provide Build-your-own (scripted) Validator expression in create screen.

Thanks in advance for the help

Regards,

Ajay

Hi @David Fischer _Appfire_ ,  one more help please,

I want to set the A drop down field values to no based on another dropdown field values.

If the field A is set to yes then second field should select the No value. tried with below code but not able to achieve the required

issue.customfield_10007.value || !! issue.customfield_10007.value == "YES" && issue.customfield_10032.value == "NO"

 Thanks again,

Ajay

David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Feb 01, 2023

Hi @Atlassian Learner 

Can you please reformulate you're requirements, I didn't quite get what you need. 

@David Fischer _Appfire_ , thanks for the prompt response,

Assume we have two dropdown fields A and B with same values Yes, No , N/A, 

If Field A is set to Yes on create then field B should not accept the values Yes , N/A it should only accept the value No.

Hope it make sense now.

Thanks,

Ajay

David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Feb 01, 2023

I think I understand the desired validation. The script would be:

!issue.customfield_10007 || issue.customfield_10007.value != "Yes" || issue.customfield_10032.value == "No"

(note that the values are case-sensitive) 

Suggest an answer

Log in or Sign up to answer