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.
×Hi Team,
I have a use case , I cannot find to create a good validator with JMWE in Jira Cloud on Create transition.
I would like to allow ours users to create an issue only on specifics combinaisons of a CF(Select list) and Components.
I use JMWE with this validators : "Build-your-own Validator"
CF_A | Component | Result condition | |
select list | A | B | |
0 | 0 | 0 | True |
0 | 0 | 1 | True |
0 | 1 | 0 | True |
0 | 1 | 1 | True |
1 | 0 | 0 | True |
1 | 0 | 1 | False |
1 | 1 | 0 | False |
1 | 1 | 1 | False |
(My Validator is on field issue Type : if issueType = Bug => block ...and we are on Bugs's Workflow.
So if condition return True => Block , if condition return false, we skip the validator and user can create the issue)
So for exemple:
If my Selectlist = "0" and I have component = "A" , my condition return "True"
So my Validator block the creation
If my Selectlist = "1" and I have component = "B" , my condition return "False"
So my Conditional validation skip the validator and the creation is allow
I try this for my conditional Validation :
(issue.customfield_10054.value == "1" && (issue.components.some(it => it.name != "A"))) || (issue.customfield_10054.value == "1" && (issue.components.some(it => it.name != "B")))
But It's not ok, still return "True"
I think because we are still one or other option .. True.
We cannot use if/else in Validator condition ( only in postfunction) right ?
So I don't know how to do this , any help are appreciate :)
A simpler version of the Jira expression:
issue.customfield_10054.value != "1" || !issue.components.some(it => it.name == "A" || it.name == "B")
which will pass if the custom field value is not "1" or if the component doesn't contain A or B
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK, I've found it ! I post answer here , if some people block like me ;)
(issue.customfield_10054.value == "1" && (issue.components.some(it => it.name == "A"))) || (issue.customfield_10054.value == "1" && (issue.components.some(it => it.name == "B"))) || issue.customfield_10054.value != "1"
But not in "Conditionnal validation" .. directly in Jira Expression !
It easy in fact ... I'm looking for too complex !
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.