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
Bella1Bella1 

Validation Rule Formula connecting two fields

I am trying to create a validation rule that connects two fields.  For example:  When the Start date is filled out, they have to fill out the End date otherwise an error pops up when they go to save.  I have tried so many different types of formulas but am missing something.  Any suggestions on how to accomplish this?

 

Thanks!

 

Best Answer chosen by Admin (Salesforce Developers) 
Steve :-/Steve :-/

Try this one

 

 

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

 

 

 You'll probably wanna have an additional validation routine that checks to make sure that the End Date is after the Start Date

 

 

Start_Date_c > End_Date__c

 

 

 

Message Edited by Stevemo on 08-31-2009 01:40 PM

All Answers

Steve :-/Steve :-/

Can you post the formula that you are using so we can take a look at it? (use the Clipboard with a "C" icon) above the post message text box.  

 

 

 

 

 

Bella1Bella1

End_Date_c > Start_Date_c End_Date <> null End_Date_c >= Start_Date_c

 

I think these are all wrong.  I am terrible at formulas.  I just want to show a conditional dependancy between the Start and End date, that if the Start date is filled out, you must always have an end date.  Thanks so much for your quick response on this.  Hopefully you can help? 

 

 

Steve :-/Steve :-/

Try this one

 

 

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

 

 

 You'll probably wanna have an additional validation routine that checks to make sure that the End Date is after the Start Date

 

 

Start_Date_c > End_Date__c

 

 

 

Message Edited by Stevemo on 08-31-2009 01:40 PM
This was selected as the best answer
Bella1Bella1

You are the best!  It worked.  Any suggestions on how or where to go to learn about formulas in detail and how to figure them out?  Thanks so much, I really appreciate your quick response.

 

Steve :-/Steve :-/

No problem, that's why they pay me the BIG BUCKS! :smileywink:

 

 

There are some great Formula and Validation guide books available here>

 

 

https://na2.salesforce.com/help/doc/en/salesforce_useful_formula_fields.pdf 

 

 

https://na2.salesforce.com/help/doc/en/salesforce_useful_validation_formulas.pdf 

Bella1Bella1
Great!  Thanks so much.  I am so glad I found this forum, now I know where to go.  :)
lburnslburns
This is basically what I want to do, but the second field needs to equal the first field value or at least make the user update the second field.  What is the command to do that?
Steve :-/Steve :-/
Can you post an example of what you are trying to do, using the Code Clipboard [C]?
Steve :-/Steve :-/

Here's a few Start Date / End Date validation formulas that you can play around with.

 

1. If Start Date is not blank then you must enter an End Date.  

 

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

 

 2. If you change the Start Date then you must update the End Date.

 

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

 3. If you change the Start Date it must equal the End Date.

 

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

 

 

 

 

 

 

lburnslburns
This works great...thank you!
lburnslburns
This worked perfectly.  Thanks!