Hello!
I'm writing a scriptrunner validator on create that checks the values of certain fields and lets the ticket be created accordingly.
Script below:
issue.customfield_14690.value == "No" ? true :
issue.customfield_14690.value == "Yes" && issue.customfield_14613 ? true :
issue.customfield_14690.value == "Yes" && (issue.customfield_14440 || issue.customfield_14611) ? true :
false
When I test this in scriptrunner directly with a ticket that has cf_14690 as Yes, and with cf_14613, cf_14440, and cf_14611 as null, I get a false, however when I actually go to create the ticket, it creates just fine.
Why is the validator not actually stopping the create transition from happening?
Edit:
Also tried the following script variations with the same results:
(issue.customfield_14690.value == "No" ||
(issue.customfield_14690.value == "Yes" && issue.customfield_14613 != null) ||
(issue.customfield_14690.value == "Yes" && (issue.customfield_14440 != null || issue.customfield_14611 != null)))
if (issue?.customfield_14690?.value == "No") {
true
} else {
if (issue?.customfield_14690?.value == "Yes" && issue?.customfield_14613 != null){
true
}
else {
if(issue?.customfield_14690?.value == "Yes" && (issue.customfield_14440 != null || issue.customfield_14611 != null)){
true
}
else {
false
}
}
}Thanks!