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
Debbie61Debbie61 

Validation Help Needed

Logically, I want to say:

 

IF status = 'Onboard' && ( startDate is Null || endDate is Null ) Then error out the record.

Or in other words, both date fields must be populated if status = 'Onboard'.

 

Now taking that and getting the right validation logic has caused me problems. Whatever code I have used, I have

either got a situation where both dates are populated and it still won't let me save, or it lets me save if none of the

dates are there.

 

This was the last one I tried.

AND( OR( CONTAINS(TEXT(Site__r.Status__c),"Onboard"), AND ( NOT(ISNULL( MACD_Start_Date__c )) , NOT(ISNULL( MACD_End_Date__c )) ) ))

 

Thanks for any help.

Best Answer chosen by Admin (Salesforce Developers) 
ujackbujackb

I am assuming that Onboard is a pick list entry ,if so this should work

 

AND ( ISPICKVAL( Picklist__c , 'Onboard'), or ( ISNULL( Date_1__c ),ISNULL( Date_2__c ) ))