When a validation rule returns
true, it prevents the record from being saved.
This runs counter to typical developer intuition (it's very easy to try to treat a validation rule like an if/else, mentally).
The better way to frame validation rules is what needs to happen for us to complain? In your case, that would be
- If the field has changed
- And the field length is not 15
- And the field is not blank
AND() instead of
OR() here, and inverting the blank check is what you want to do. When the field is 15 characters, it doesn't satisfy all 3 conditions. When the field is blank, it doesn't satisfy all 3 conditions.
NOT(LEN(field) = 15),
Side note: It's usually a good idea to avoid mixing notation in formulas/validations. Choose to use
|| and stick with it. Otherwise, you're setting yourself up for semantic errors (i.e. things have a higher chance of being evaluated in a way that you didn't intend).