I have a scripted behavior that is set (on FieldA and FieldB) and works correctly. Here is the logic:
IF FieldA or FieldB is populated, then make FieldC required.
This logic works, but I am trying to put an additional behaviour in place(on FieldC) that says
"IF FieldC is updated back to "None" (Default) after it is made required, check to see if FieldA or FieldB is populated. If neither is populated, clear error and make FieldC no longer required. If either is populated, throw original error on FieldC again"
Here is how I have written the serverside script for the behaviour, but it is not working. Can anyone help guide me to the correct scripting?
{code}
def FieldAValue= FieldAField?.getValue() as String
def FieldBValue = FieldBField?.getValue() as String
def FieldCValue = FieldCField?.getValue() as String
if ((FieldCValue == "None" && FieldAValue) || (FieldCValue == "None" && FieldBValue ))
{
FieldCField.setRequired(true)
FieldCField.setError("Please make a selection other than 'None'")
}
else
{
FieldCField.setRequired(false)
FieldCField.clearError()
}
{code}