I was working on a validation rule formula, and noticed that whatever criteria I provided, the formula was returning true. I stripped out the criteria in the formula, until I had a simple formula:

ISBLANK( BillingState )

Validation Rule

This formula is returning true regardless of what I put into the standard BillingState field on the standard Account object.

BillingState with valid value, and error message BillingState with invalid value, and error message

Once I add a value to the field, I would expect ISBLANK(...) to return false, and allow the record to be saved, but this doesn't seem to be the case.

  • 1
    There is the option in formulas, treat blank field as zeroes. Make sure it's set to treat as blank Jul 26 '16 at 15:43
  • I don't believe that option is supported in validation rules, @IlyaLepesh. I'm unable to locate the option when editing the validation rule. Jul 26 '16 at 15:46
  • 1
    Can you check if any triggers clear that field out? The only way I was able to repro was when before triggers set it to null.
    – Adrian Larson
    Jul 26 '16 at 15:59
  • Are you using the State and Country picklists? If so, you should be using BillingStateCode instead.
    – sfdcfox
    Jul 26 '16 at 16:06
  • 1
    I had just started looking into the related triggers more deeply, and that was the cause. A before update trigger was trying to assign an empty value to the field based on a related object (which was part of the original validation rule). I would have expected a DmlException, rather than the error showing back up on the page, as a validation error. Jul 26 '16 at 16:06

I have experienced similar behavior when I had a before trigger that cleared out the value. This can cause an unfortunate User Experience where it looks like the field is filled in, but in reality the save fails because the field gets set to null before the validation is performed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.