[SalesForce] Validation rule not firing if there are empty spaces in Long text area field

I have a validation rule that should fire whenever there is a value on field 'A' and the 'description' field Long Text Area(32000)) of case object is left blank.

This rule fires for manual cases but when case is created via email to case and

  1. if the description field is blank

  2. User edits and saves the record

  3. due to some blank space at the start of the description field, the rule does not fire. Seems like some empty space.

please help.

Validation rule…

(
    (TRIM(Description ) == '') 
    ||  LEN(TRIM(Description ))  = 0
)
&& NOT(ISBLANK(Text( A__c )))

Best Answer

You should use ISBLANK() along with TRIM() function to check the empty spaces or blank.

(ISBLANK(Description) 
|| LEN(TRIM(Description)) =0 )  
&& NOT(ISBLANK(Text( A__c )))
Related Topic