+ Start a Discussion
SkeeterSkeeter 

Validation Rule (Checkbox and Picklist Combo)

I'm trying to write a validation rule where if a checkbox is check then certain values cannot be used.  I've tried a couple of different variations but the validation is firing when it shouldn't be.
 
#1
AND(
Project_Phase__r.Project__r.Capital_Project__c = FALSE, 
OR( 
ISPICKVAL(Accounting_Category__c,'App Dev Phase - Analysis' ) , 
ISPICKVAL(Accounting_Category__c,'App Dev Phase - Design ' ) , 
ISPICKVAL(Accounting_Category__c,'App Dev Phase - Build' ), 
ISPICKVAL(Accounting_Category__c,'App Dev Phase - Implementation' ), 
ISPICKVAL(Accounting_Category__c,'App Dev Phase - Testing' )
))


#2
AND( 
OR( 
ISPICKVAL(Accounting_Category__c,"App Dev Phase - Analysis") , 
ISPICKVAL(Accounting_Category__c,"App Dev Phase - Design") , 
ISPICKVAL(Accounting_Category__c,"App Dev Phase - Build"), 
ISPICKVAL(Accounting_Category__c,"App Dev Phase - Implementation"), 
ISPICKVAL(Accounting_Category__c,"App Dev Phase - Testing), 
OR( 
Project_Phase__r.Project__r.Capital_Project__c = FALSE )))

 
Best Answer chosen by Skeeter
Mudasir WaniMudasir Wani
Hey lilranger,

Use the below code.
AND( Project_Phase__r.Project__r.Capital_Project__c == false ,OR( ISPICKVAL( Accounting_Category__c , 'App Dev Phase - Analysis') ,ISPICKVAL( Accounting_Category__c , 'App Dev Phase - Design'),ISPICKVAL( Accounting_Category__c , 'App Dev Phase - Build'),ISPICKVAL( Accounting_Category__c , 'App Dev Phase - Implementation'),ISPICKVAL( Accounting_Category__c , 'App Dev Phase - Testing')))
Let me know in case of any issue.


Donot forget to select best answer to make our efforts visible in the developer forum.
Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help

All Answers

Mudasir WaniMudasir Wani
Give a description of the validation then only we can help 
SkeeterSkeeter
I listed 2 ways I tried to do the validation.  
The desired behavior is that if the Capital Project Checkbox is not checked on the Project object to not allow the user to select 1 of the 5 accounting categories I have listed.
Pankaj_GanwaniPankaj_Ganwani
Hi,

Can you please try with it?

AND(OR(ISPICKVAL(Accounting_Category__c,"App Dev Phase - Analysis"),ISPICKVAL(Accounting_Category__c,"App Dev Phase - Design"),ISPICKVAL(Accounting_Category__c,"App Dev Phase - Build"),ISPICKVAL(Accounting_Category__c,"App Dev Phase - Implementation"),ISPICKVAL(Accounting_Category__c,"App Dev Phase - Testing)),Project_Phase__r.Project__r.Capital_Project__c = FALSE )
SkeeterSkeeter
It's still generating the error when it shouldn't be.
Mudasir WaniMudasir Wani
Hey lilranger,

Use the below code.
AND( Project_Phase__r.Project__r.Capital_Project__c == false ,OR( ISPICKVAL( Accounting_Category__c , 'App Dev Phase - Analysis') ,ISPICKVAL( Accounting_Category__c , 'App Dev Phase - Design'),ISPICKVAL( Accounting_Category__c , 'App Dev Phase - Build'),ISPICKVAL( Accounting_Category__c , 'App Dev Phase - Implementation'),ISPICKVAL( Accounting_Category__c , 'App Dev Phase - Testing')))
Let me know in case of any issue.


Donot forget to select best answer to make our efforts visible in the developer forum.
Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help
This was selected as the best answer
Mudasir WaniMudasir Wani
Hello lilranger,

What is the status.
Use the above code it works perfectly.


Donot forget to select best answer to make our efforts visible in the developer forum.
SkeeterSkeeter
Thank you Mudasir.   I think I figured out that there was nothing wrong with my validation or your validation.  The page it's displaying on is part of a 3rd party package.  I believe it's an issue with their package and not with the validation.