function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MRivasMRivas 

Validation rule for 2 fields that are picklist

Hi all, 
I am trying to write a validation rule that works like this, If field A (picklist) is filled with any value then field B(picklist) has to be yes. 

For example: If (field A) current_grade__c  has a choise selected, High School, Middle, Elementry... then (field B) enrolled_in_school__c, Has to be "YES", it cannot be No, Unknown or left blank. 

Sai PraveenSai Praveen (Salesforce Developers) 
Hi,

Can you try the below validation rule.
 
AND(NOT(ISBLANK(TEXT( current_grade__c ))), TEXT( enrolled_in_school__c ) !='Yes')
Let me know if you face any issues.

If this solution helps, Please mark it as best answer.

Thanks,

 
mukesh guptamukesh gupta
Hi  MRavis,

You need to create Field Dependency from Object level.  SETUP ==>> OBJECT MANAGER=>> YOUR OBJECT then click on Field dependencies

Field A -->>  will be Controlling field
Filed B -->> will be dependent filed

if you need any assistanse, Please let me know!!

Kindly mark my solution as the best answer if it helps you.

Thanks
Mukesh 
MRivasMRivas

Hi all, I ended up with this validation: 

AND (NOT(ISPICKVAL( enrolled_in_school__c , "Yes")), ISBLANK( TEXT( current_grade__c ) ) ). Now the problem I am having is that if I delete the grade the enrolled in school field still gives me an error. I am not sure how to fix it.