0

I need to make a validation rule with picklist. If Picklist value is "Yes" all 3 other custom fields to be populated (cannot be empty). The formula below works only with one of them, does not take all of them, can someone help me with it? Thanks!

AND( ISPICKVAL( Immediate_Relatives__c , "Yes"), ISBLANK(Relative_Full_Name__c)&& ISBLANK( Relationship_to_you__c)&& ISBLANK(Status__c )) 

2 Answers 2

1

Validation rules are in a way the reverse of how we programmers normally think of things.

If the validation rule evaluates to true, the validation trips and prevents the record from being saved. We're not making a rule to determine what is valid, we're making a rule to tell us what is invalid.

So when you say "all 3 fields must not be blank", that translates to "if any of these fields are blank, trip the validation".

In short, you need to be using OR instead of AND when you check for blank fields here.

AND( ISPICKVAL(Immediate_Relatives__c, "Yes"), OR( ISBLANK(Relative_Full_Name__c), ISBLANK(Relationship_to_you__c), ISBLANK(Status__c) ) ) 

You still need the outermost AND there, which kicks you out of the validation rule when Immediate_Relatives__c is "No"

1
  • Thanks Derek, solved it. Commented Feb 10, 2021 at 18:36
0

Your formula is not correct, you are mixing AND() and &&. You should use one or the other but not both:

AND( ISPICKVAL(Immediate_Relatives__c, "Yes"), ISBLANK(Relative_Full_Name__c), ISBLANK(Relationship_to_you__c), ISBLANK(Status__c) ) 
1
  • Hi David, thanks, but it still does not give the requested result. If picklist is YES and if I put some value on one of those fields and keep empty other ones it allows me to save, but what I need is to put values on all 3 fields. How I can achieve that? Commented Feb 10, 2021 at 17:41

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.