+ Start a Discussion
MATTYBMEMATTYBME 

Validation rule

I am trying to write a validation rule that evaluates if a number field is greater than 0 that a date value must be entered in a date field.

 

Not sure what I am doing. Any help would be great. Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
Steve MolisSteve Molis

Matt,

 

I think you might want something like this

 

 

AND (NOT(number_field < 1),ISNULL(date_field))

 

 

All Answers

Steve MolisSteve Molis

Matt,

 

I think you might want something like this

 

 

AND (NOT(number_field < 1),ISNULL(date_field))

 

 

This was selected as the best answer
MATTYBMEMATTYBME
Perfect Thanks!
Steve MolisSteve Molis
That's why they pay me the BIG bucks! :smileywink:
MATTYBMEMATTYBME
Lucky you :smileyhappy:. Seriously it is a big help, thanks.
Message Edited by MATTYBME on 09-15-2009 08:16 AM
lburnslburns
Hi...I'm trying to do the same thing but instead of a number field, it's a date field.  If the date field is populated, then the other date field needs to be updated.  Can't figure it out.
Steve MolisSteve Molis

So basically "If Date 1 is not blank, then Date 2 can't be blank either"?

 

 

If that's what you're looking for, then you want something like this 

 

AND(NOT(ISNULL(Start_Date__c)), ISNULL( End_Date__c ))

 

 

 

Message Edited by Stevemo on 09-29-2009 05:20 PM
lburnslburns

Thanks...there's already data in the field that needs to be updated, so I need to make sure the opportunity doesn't save until that field is actually changed only when the first field is populated...

 

i.e.  Acceptance Date has been entered, now the Close Date needs to be changed (this is the field that already had a date in it that needs to reflect the new 'Acceptance Date').

Steve MolisSteve Molis

Okay, does the Close Date have to be updated to have the same date value in it as Acceptance Date?

 

 

Steve MolisSteve Molis

 If you just want them to have to update it then you can try something like this

 

 

AND( ISCHANGED(Start_Date__c), PRIORVALUE(End_Date__c ) = End_Date__c )

 

If you need the Close Date to have the same value as the Acceptance Date then you might want something like this.  

 

 

AND( ISCHANGED(Start_Date__c), Start_Date__c <> End_Date__c )

 

 

 

 

lburnslburns
I just saw this....thank you!  It works just fine.