Hello
I am trying to create script runner validator that should check select list custom field and another field based on select list field.
E.g. I have select list FieldA with values "Yes", "No" and "None" (empty). I need to check if FieldA is "Yes", then "FieldB" should be > 0. So my current working validator is
(cfValues['FieldA'].getValue() == "Yes" && cfValues['FieldB'] > 0) || (cfValues['FieldA'].getValue() == 'No')
But I need also to check if fieldA is "None", and I am unable to find correct statement for it I tried
(cfValues['FieldA'].getValue() == "Yes" && cfValues['FieldB'] > 0) || (cfValues['FieldA'].getValue() == 'No') || (cfValues['FieldA'] == null)
but it seems it is doesn;t work
What is the correct statement? Is it possible to optimize validator expression (without writing expression in one row) e.g.:
if(fieldA=="Yes"){
if(fieldB<=0){
//Validator was NOT passed
// show message
}
else{
//validator was passed
}
}
else{
//validator was passed
}
Thank you in advance,
Fyodor