Question regarding validation rules for textbox

Hi I am trying to make some validation rules for a textbox as follows:

a!textField(
label: "Serial Number",
value: ri!module.serialNumber,
saveInto: ri!module.serialNumber,
required: true,
validations: if(
rule!APN_isBlank(
ri!module.serialNumber
),
{},
if(
rule!ICAMS_checkDuplicateSerialNumber(
ri!module.serialNumber
),
"Serial Number Already Exists",
{}
)
)
/*validationGroup: "Duplicate"*/
)

The rule ICAMS_checkDuplicateSerialNumber() works perfect when tested out seperately and returns true() and false(), but its always true when used in an if loop as above. Does anyone has any idea why is it behaving that way?

OriginalPostID-212679

OriginalPostID-212679

  Discussion posts and replies are publicly visible