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
Cameron SeitzCameron Seitz 

Validation Rule That States If = Y, Field Must Be Null

I have a field that has a picklist that offers the options "Y" or "N". I have a separate field that needs to be empty if the answer is Y and required if the answer is N to that previous field. 

This is the validation I have to make it required if "N": 

AND( 
ISPICKVAL(Bank_Full_Deposit_Flag_1__c , "N") 
)



The field that it is applied to is called "Bank_Deposit_Deduction_Amount_1__c"
I just can't seem to figure out the "Must be blank" part for "Y". Appologies if I'm missing something obvious here. I have been going through the guide and can't seem to find it. 
Best Answer chosen by Cameron Seitz
Cameron SeitzCameron Seitz
This is what I ended up using:


OR( 
AND( 
ISPICKVAL(Bank_Full_Deposit_Flag_1__c , "N"), 
ISBLANK(Bank_Deposit_Deduction_Amount_1__c) 
), 
AND( 
ISPICKVAL(Bank_Full_Deposit_Flag_1__c,"Y"), 
NOT(ISBLANK(Bank_Deposit_Deduction_Amount_1__c) 
)) 
)

All Answers

Karthik KKarthik K
Can you try something like below.

IF(AND(TEXT(Bank_Full_Deposit_Flag_1__c) == 'Y', ISBLANK(Other_Field__c)), true, false)
Cameron SeitzCameron Seitz
I think it's missing something and I think I explained it poorly. Bank Full Deposit Flag 1 is a picklist and Bank Deposit Deduction Amount is Text. 

It would basically need to cover both of these stipulations in one rule:
If Bank Full deposit Flag 1 is "N" then Bank Deposit Deduction Amount is required.
If Bank Full Deposit Flag 1 says "Y" then the bank Deposit Deduction Amount Must Be Null
Cameron SeitzCameron Seitz
This is what I ended up using:


OR( 
AND( 
ISPICKVAL(Bank_Full_Deposit_Flag_1__c , "N"), 
ISBLANK(Bank_Deposit_Deduction_Amount_1__c) 
), 
AND( 
ISPICKVAL(Bank_Full_Deposit_Flag_1__c,"Y"), 
NOT(ISBLANK(Bank_Deposit_Deduction_Amount_1__c) 
)) 
)
This was selected as the best answer