0

I have a rich text field on my object and have validation to check if it is blank I want to throw an error message.

ISNULL(richText__c) in validation returns FALSE - I'm okay with this.

ISBLANK(richText__c) in validation returns FALSE - Why?

richText__c = '' in validation returns TRUE - Surprising!

Can someone explain this behavior?

2
  • In the database, what is the value of rich_text__c? is it null or an empty string?
    – cropredy
    Commented Jan 23, 2020 at 22:39
  • It is an empty string. Commented Jan 24, 2020 at 11:16

1 Answer 1

2

Rich text fields are a little wonky. ISNULL and ISBLANK don't work with this field type, period.

To check NULL on this data type field we need to use LEN. It basically calculates the number of characters.

So if you have VR like this: LEN(richText__c) = 0

If you insert an image in the field, the rule will not fire. It will only fire once you add a space before or after the image. So basically it's counting the characters.

But why richText__c = '' this fired?

That's because it's doing the same thing as LEN and only counting characters. Why we should not use this to check NULL in general because it only checks the size and not the initialization in the memory(NULL check).

Article for reference: https://help.salesforce.com/articleView?id=000329422&type=1&mode=1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .