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.

  • 1
    What is the data type of Email body ? – Vijay Ganji Mar 12 at 15:02
  • it is a rich text area (32768) – Logie C Mar 12 at 15:06
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 ) 
    ) 
)
  • 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 at 22:59
  • Thanks @Eric for pointing that out. Corrected it in the answer. – Vijay Ganji Mar 13 at 2:38

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.