I have a field Expiration Date. I want to validate that field so that the user can't put future dates. The dates should always be in past.

I tried the following but I am still able to save record by putting future dates.

AND( ISNEW(), ExpirationDate__c < TODAY())

  • 1
    Your question's title and body are contradictory. One says past date and one says future date. Can you edit your question and clarify the behavior you're trying to achieve? In addition, the isnew function will prevent this from being a validation error during an edit. Is that what you're trying to prevent? (only a validation on creation of a new record?) – Mark Pond Nov 13 '14 at 19:01
  • @Mark thank your reply. my validation rule might be wrong. but what I want to achieve is whenever a user tries to put a date the user should be only allowed to put past date. Also I want this functionality when someone tries to edit too. – LazyBones Nov 13 '14 at 19:15

Validation rule expressions, if they evaluate to TRUE, will cause the Validation error to display. As such

Expiration_date__c > TODAY()

should be all you need - will execute on New record, edit existing record, and any other DML update like data loader, triggers, etc.

Why an expiration date always needs to be in the past is odd, but I'll leave that to your application design; you should also change the title of the question to say 'prevent future dates' as Mark Pond noted

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.