+ Start a Discussion
GrifmangGrifmang 

Data Validation help please

Hey Guys,

 

    I'm trying to create a quick data validation rule and seem to be having some trouble. I'm trying to make it so if one date field is used on a lead then 2 other text fields are required to save the contract. I have this so far, but keep getting errors:

 

 

and(
Appointment__c
,len(Appointment_Time__c, Appointment_City__c)=0
)

 

Thanks for the help in advance!

 

Best Answer chosen by Admin (Salesforce Developers) 
CaptainObviousCaptainObvious

See if this helps:

 

AND( 
    NOT(ISBLANK(Appointment__c)), 
    OR ( LEN(Appointment_Time__c)=0, LEN(Appointment_City__c)=0 ) 
)

 

All Answers

paulmagpaulmag

Hi there, I cant see from your post where you have specified which date field has been populated and therefore when the validation rule should be called. Also I think your formula should look for the either the appointment time OR city to be empty, it currently looks as though the formula will only work when they are both empty. As a final thing I always use <=1 as my criteria, not sure why but I think I had a reason for it in the past.

 

Good luck

 

Paul

GrifmangGrifmang

Yeah that is kind of where I was getting confused. I didn't know if I was supposed to use the DATEVALUE command, or something different.

 

Like to say my date field is Appointment__c. I could just create 2 DV if I need to, should that be a problem as well. But I just can't for the life of me figure out how to actually have it look at the Date field.

 

Thanks.

CaptainObviousCaptainObvious

See if this helps:

 

AND( 
    NOT(ISBLANK(Appointment__c)), 
    OR ( LEN(Appointment_Time__c)=0, LEN(Appointment_City__c)=0 ) 
)

 

This was selected as the best answer
GrifmangGrifmang

Well Thank You CaptainObvious ....

 

I gotta admit its pretty awesome to say that and mean it .... heh