Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 21:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×Hello Community
I have 3 custom fields which are Multi select drop down. All 3 custom fields displays Same values. When User select Same value in more than 1 custom field and do the transition then its should not allow user to do the transition. Is there any way that i can use Jira validators to validate the duplicates and display the Error message.
Ex: Custom Field 1: Apple, Orange
Custom Field 2: Mango, Orange
Custom Field 3: Banana, Strawberry
In above example user selected Orange in 2 custom Fields. So when user do the transition It should check field values in all 3 custom fields and if they found duplicates then it should display error message and blocks the Transition.
Note: We are using Jira Cloud with Jira Misc Workflow Extensions (JMWE)
Hi @Prathap DL
since you're on Jira Cloud, you can use a "Build-your-own Validator (JMWE app)" validator on the transition, with code written using Atlassian's Jira Expressions language:
let field1 = issue.customfield_12345.map(val => val.value);
let field2 = issue.customfield_23456.map(val => val.value);
let field3 = issue.customfield_34567.map(val => val.value);
!field1.some(val => field2.includes(val) || field3.includes(val)) && !field2.some(val => field3.includes(val))
where you'll replace customfield_12345 with the custom field ID of your first Multi select drop down custom field, customfield_23456 with the custom field ID of your second Multi select drop down custom field, and customfield_34567 with the custom field ID of your third Multi select drop down custom field.
Thanks for the Answer.
The Jira expression working when There is a duplicate. But I'm also facing one issue that, whenever all 3 fields are empty or 1 of the field is empty That time also script is blocking the transition.
I need to run this script when "Conditional validation" to check Jira expression value.
With above Jira expression there are 3 results will display.
1. True: When all 3fields are filled and there are no duplicates
2. False: When all 3 fields are filled and there are duplicates
3. Error: When any one of the Field is empty or all the 3 Fields are empty.
Now I want this expression to block the transition when Jira value is "False".
For True or Error it should ignore and allow the Transition.
Also is there any way that we can get Proper message instead of Generic message.
For Ex: Custom Field 1: Apple, Orange
Custom Field 2: Mango, Orange
Custom Field 3: Banana, Strawberry
"Orange" is selected in more than 1 custom field
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Prathap DL
sorry, i forgot to include code in my script for that. Try this:
let field1 = issue.customfield_12345?.map(val => val.value) || [];
let field2 = issue.customfield_23456?.map(val => val.value) || [];
let field3 = issue.customfield_34567.map(val => val.value) || [];
!field1.some(val => field2.includes(val) || field3.includes(val)) && !field2.some(val => field3.includes(val))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @David Fischer Getting below Error.
Evaluation failed: "issue.customfield_14277?.map(val => val.value)" - issue.customfield_14277?.map (null) is not a function
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you try this:
let field1 = issue.customfield_12345 ? issue.customfield_12345.map(val => val.value) : [];
let field2 = issue.customfield_23456 ? issue.customfield_23456.map(val => val.value) : [];
let field3 = issue.customfield_34567 ? issue.customfield_34567.map(val => val.value) : [];
!field1.some(val => field2.includes(val) || field3.includes(val)) && !field2.some(val => field3.includes(val))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@David FischerIt worked
"I really appreciate your assistance, it made all the difference in solving my problem!".
One last question, Currently i added Generic message in Error Message Field that says "duplicate value is selected in more than 1 custom Field".
Instead of this Can we add the duplicate field value with Error message.
Ex: Orange is selected in more than 1 custom Field
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately, I don't believe this is possible. It's a limitation of Jira Cloud.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Prathap DL ,
Use the below script in the Groovy and try. Add a "Scripted (Groovy) Validator" from JMWE.
def field1 = issue.get("customfield_1")?.toSet() ?: [] def allValues = field1 + field2 + field3 if (duplicates) { return true |
When you set up the validator, you can specify an error message that will be displayed to the user if duplicates are found. For example: "You have selected the same value in more than one field. Please ensure each value is unique across the custom fields."
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the Reply.
Where exactly I need to put this code. I don't see Scripted (Groovy) Validator" from JMWE.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.