Skip to main content
Hi,

 

Here is my condition - "If Preferred Email field has been chosen and that corresponding specific email field doesn't have a value but another specific email field does, then the user should correct either the Preferred Email field or the specific email field value."

AND (

$Profile.Name <> "Custom Profile",

OR (

AND (ISPICKVAL( npe01__Preferred_Email__c , "Alternate" ), ISBLANK(npe01__AlternateEmail__c), (OR (NOT(ISBLANK( Loop_Email__c )), NOT(ISBLANK( npe01__HomeEmail__c )), NOT(ISBLANK( npe01__WorkEmail__c ))

))),

AND (ISPICKVAL( npe01__Preferred_Email__c , "Loop Email" ), ISBLANK(Loop_Email__c), (OR (NOT(ISBLANK( npe01__AlternateEmail__c )), NOT(ISBLANK( npe01__HomeEmail__c )), NOT(ISBLANK( npe01__WorkEmail__c ))))),

AND (ISPICKVAL( npe01__Preferred_Email__c , "Personal" ), ISBLANK(npe01__HomeEmail__c), (OR (NOT(ISBLANK( npe01__AlternateEmail__c )), NOT(ISBLANK( Loop_Email__c )), NOT(ISBLANK( npe01__WorkEmail__c ))))),

AND (ISPICKVAL( npe01__Preferred_Email__c , "Work" ),

ISBLANK(npe01__WorkEmail__c ), (OR (NOT(ISBLANK( npe01__AlternateEmail__c )), NOT(ISBLANK( Loop_Email__c )), NOT(ISBLANK( npe01__HomeEmail__c )))))

)

)

The above validation rule is not working.

 

Can anyone correct my validation rule?

 

Thanks,
10 answers
  1. Jun 28, 2016, 3:40 PM
    Honestly, to avoid a generic error message, I would create 4 differtent validation rules so that you can show a specific error message on the specific field rather than a generic error message at the top of the page.  

     

    So for Alternate, it would be 

     

     

    AND (

         $Profile.Name <> "Custom Profile",

         ISPICKVAL(npe01__Preferred_Email__c , "Alternate"),

         ISBLANK(npe01__AlternateEmail__c)

    )

     

    Then you could have an error message on the Alternate Email field that says something like 'You have indicated that the preferred email address is Alternate, but it is blank, please fill in this email address or change you preffered email'

     

    You could just adjust this rule to work for all the other possiblities, so for Personal it would be 

     

     

    AND (

         $Profile.Name <> "Custom Profile",

         ISPICKVAL(npe01__Preferred_Email__c , "Personal"),

         ISBLANK(npe01__HomeEmail__c)

    )

     

    And so on....   hope that helps
0/9000