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
WPCMSWPCMS 

Formula for Validation: If start date is less than current month

I need to prevent users from entering start dates that are less than the current month and year.

 

Thank you in advance

Best Answer chosen by Admin (Salesforce Developers) 
WYamWYam

Simply add the ISNEW() function to it

 

 

AND(IF(OR(MONTH(CloseDate)<>MONTH(today()),YEAR(CloseDate)<>YEAR(today())),true,false),isnew())

 

 

 

Message Edited by WYam on 03-01-2010 10:19 AM

All Answers

WYamWYam

In the strictest sense, this would work

 

 

IF(OR(MONTH(CloseDate)<>MONTH(today()),YEAR(CloseDate)<>YEAR(today())),true,false)

 

 You could play around with it as well to make it more flexible if you wanted to. I hope this helps.

 

WPCMSWPCMS
The problem is that if a record is edited, and the start date is from another period, it shows the validation error. How can I have this recognize this at create only?
WYamWYam

Simply add the ISNEW() function to it

 

 

AND(IF(OR(MONTH(CloseDate)<>MONTH(today()),YEAR(CloseDate)<>YEAR(today())),true,false),isnew())

 

 

 

Message Edited by WYam on 03-01-2010 10:19 AM
This was selected as the best answer
WPCMSWPCMS

That works! And then to prevent users from editing the start date on an existing record, I did an ischanged on the date.

 

Thank you.