Hi all I am trying to set an error if certain values are selected in a multi select field AND a specific value is selected for another custom field.
I have this working in a behavior mapped to the first custom field. However, when the value of the second field is updated the error still appears. I cannot capture the field changed for the second field alongside the first.
Any suggestions for how I can capture both values?
heres an example of what i'm trying to do
// get field1 - field selected in behavior
def fieldChanged = getFieldById(getFieldChanged())
def selectedOption = fieldChanged.value
// get field1 values into a list
def chosenValuesList = []
if (selectedOption in String) {
chosenValuesList.add(selectedOption)
} else if (selectedOption in ArrayList) {
chosenValuesList.addAll(selectedOption)
}
def field2 = getFieldByName("field2")
def field2Value = field2.getValue() as Integer
if (selectedOption && field2Value == 1 && field2Value < chosenValuesList.size()){
selectedOption.setError(lessError)
}
else{
selectedOption.clearError()
}
Welcome to the community!
I maybe wrong but looks like you are checking the hardcoded value of field2 in the last 'if' condition where you are comparing 'field2Value == 1'.
So, regardless of what the actual value of 'field2' selected, the 'if' statement is always checking for '1'.
Hope this helps.
Thanks,
Vamsi
Thanks Vamsi! I am comparing it to the number of multi select fields selected and it would need to be 1 to invalidate. I was able to get it to work with 2 behaviors.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.