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
SL TanSL Tan 

Need advise on custom formula for Date Field


I am trying to put in a control formula for the date field where a user can only select a date that is on the same day the user is inputing the data or a day that is earlier but the user cannot select the next day or a date that is later. Does anyone try to do this before? If so, I would appreciate some advise on how to code for the formula in the date field. Any help will be highly appreciated. Thanks in advance
SL

Best Answer chosen by Admin (Salesforce Developers) 
Harry JamesHarry James
TODAY requires the ending parens --  TODAY()

All Answers

TheBootTheBoot
Why could this not be accomplished by seting a validation rule that compares a date field with the value TODAY, ie Check_Date_c > TODAY, so anything that would be a date greater than today would fire off an error message?
 
I tried to do this, but TODAY gives me a syntax error. 
 
-Anyone out there have any ideas?
Harry JamesHarry James
TODAY requires the ending parens --  TODAY()
This was selected as the best answer
SL TanSL Tan
Hi
Thanks for your advise to use Validation Rule - this solves my problem - and thanks for the coding direction too
Best Regards
SL
SL TanSL Tan
Hi Harry James
Thanks for your post - it really helps! I am now able to solve all my date fields that need validation rules
Best Regards
SL