I have a field validation for close date on the opportunity object. The goal is that the date cannot be over 4 years ago.
This date field is part of flow, and I noticed that when I did the date exactly four years ago from today's date, opportunity and allocation couldn't be created. Which was a win.
However there's a loophole and i'm not sure how to compensate for it. When I put a date in the past that exceeds today's day date, for instance 19th of july in 2019, today's date is 17th of July,
the validation doesn't work for this, and so the flow goes and creates the records.
this is the field validation I used:
AND( ISPICKVAL( StageName , "Received") , CloseDate <= ADDMONTHS( TODAY() ,-4*12) )
I tried to combine excel with salesforce formulas in making this. I feel like its a frankenstein's monster type of formula :/