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
sheeba Ssheeba S 

Validation for picklist value required

Hi All,
I have a Validation Rule where all the fields are required 
Picklist( Category__c ), 
Picklist( Course_Name__c ),
Duration_in__c 
Course_Fees__c  ,but one of the Course_Name__c,  Duration is  not Mandatory 

here I have tried 

AND(
 ISBLANK( Category__c ), 
 ISBLANK( Course_Name__c ),
 ISBLANK( Duration_in__c ),
 ISBLANK( Course_Fees__c ) 

OR 

(ISPICKVAL( Course_Name__c  , 'Java')
 && NOT(ISBLANK( Duration_in__c))


Thanks in Advance 
Best Answer chosen by sheeba S
SteveMo__cSteveMo__c
Try something like this
OR(
AND(
TEXT( Course_Name__c ) = 'Java',
OR(
ISBLANK( Category__c ), 
ISBLANK( Course_Fees__c ) 
)
),
AND(
TEXT( Course_Name__c ) <> 'Java',
OR(
ISBLANK( Category__c ), 
ISBLANK( Duration_in__c ),
ISBLANK( Course_Fees__c ) 
)
)
)

 

All Answers

Raj VakatiRaj Vakati
this is enough  ..use this
 
OR (
 ISBLANK( Category__c ), 
 ISBLANK( Course_Name__c ),
 ISBLANK( Duration_in__c ),
 ISBLANK( Course_Fees__c ) 
)

 
SteveMo__cSteveMo__c
Try something like this
OR(
AND(
TEXT( Course_Name__c ) = 'Java',
OR(
ISBLANK( Category__c ), 
ISBLANK( Course_Fees__c ) 
)
),
AND(
TEXT( Course_Name__c ) <> 'Java',
OR(
ISBLANK( Category__c ), 
ISBLANK( Duration_in__c ),
ISBLANK( Course_Fees__c ) 
)
)
)

 
This was selected as the best answer