0

i have created a new validation rule which should prevent saves to a dunning action record if the type is email and either email body OR email subject is null.

Currently i have:

AND( 
    ISPICKVAL(Dunning_Action_Type__c, "Email"), 
    OR( 
        ISBLANK( Email_Body__c ),
        ISBLANK( Email_Subject__c ) 
    )
)

But i am still able to save with type = email and body null if subject is populated.

2
  • 1
    What is the data type of Email body ? Mar 12, 2019 at 15:02
  • it is a rich text area (32768)
    – Logie C
    Mar 12, 2019 at 15:06

1 Answer 1

1

As Email body is a rich text field, you will always get false when you use ISBLANK or ISNULL in a validation rule.

You will have to use LEN function in validation rule to check if it is null.

Below validation rule should work for you

AND( 
    ISPICKVAL(Dunning_Action_Type__c, "Email"), 
    OR( 
        LEN( Email_Body__c )= 0,
        ISBLANK( Email_Subject__c ) 
    ) 
)
2
  • If you always get true then the validation would always prevent save. Did you mean isblank and isnull on rich text always returns false?
    – Eric
    Mar 12, 2019 at 22:59
  • Thanks @Eric for pointing that out. Corrected it in the answer. Mar 13, 2019 at 2:38

You must log in to answer this question.

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