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
Terry_0101Terry_0101 

Can I select a specific picklist value, if date field is entered?

if a user enters a date value into a date field, can a validation field require a specific picklist value?

AND( 
ISBLANK(Ending_Date__c), 
OR( 
ISPICKVAL( Status__c, 'Pink'), 
ISPICKVAL( Status__c, 'Red')))
UC InnovationUC Innovation
Yes, I don't see why that wouldn't work. According to that formula, if Ending_Date__c is blank and the picklist value is pink or red, then the validation rule will fire, meaning the picklist value must not be pink or red. 
Terry_0101Terry_0101
Actually, I want the picklist to be enforced if the Ending Date is entered.  Not the other way around.
UC InnovationUC Innovation
AND( 
!ISBLANK(Ending_Date__c), 
OR( 
ISPICKVAL( Status__c, 'Pink'), 
ISPICKVAL( Status__c, 'Red')))

This way, if Ending_Date__c is entered, then the picklist value CANNOT be Pink or Red. 
UC InnovationUC Innovation
if you want the picklist values to be pink or red only when the date is entered, then try this formula:

AND( 
!ISBLANK(Ending_Date__c), 
OR( 
!ISPICKVAL( Status__c, 'Pink'), 
!ISPICKVAL( Status__c, 'Red')))
Akhil AnilAkhil Anil
Hi Terry,

If you want to enforce the picklist to require a specific value when the date is populated, then you do it like this
 
AND(
NOT(ISBLANK(Datefield)),
OR(
TEXT(Status__c) <> "Specific value here",
ISBLANK(TEXT(Status__c))
)
​)

Just put the specific value you want to be enforce in the formula above and that should work. If not elaborate more on whar exactly are you trying to achieve.

 
Terry_0101Terry_0101
This does not work, as I'm not able to save when I select PINK and with a date.

AND( 
!ISBLANK(Ending_Date__c), 
OR( 
!ISPICKVAL( Status__c, 'Pink'), 
!ISPICKVAL( Status__c, 'Red')))
UC InnovationUC Innovation
Apologies, it should look like this:

AND( 
NOT(ISBLANK(Ending_Date__c)), 
AND( 
NOT(ISPICKVAL( Status__c, 'Pink')), 
NOT(ISPICKVAL( Status__c, 'Red'))))