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
Victoria KerryVictoria Kerry 

validation rule close date not running

Hello All,

I'm currently using this validation rule to stop people from editing an opportunity if the close date is 7 days before today and thhe stage is a certain value, but it's not working:
AND(
NOT(IsClosed),
CloseDate < (TODAY()-7),

OR(
ISPICKVAL(StageName, 'Referral (10%)'),
ISPICKVAL(StageName, 'Pipeline (20%)'),
ISPICKVAL(StageName, 'Top Prospect (50%)'),
ISPICKVAL(StageName, 'Likely (70%)'),
ISPICKVAL(StageName, 'Commit (90%)')
)

)
Can anyone help?
VinayVinay (Salesforce Developers) 
Hi Victoria,

Try below.
 
AND(
NOT(IsClosed),
CloseDate <= (TODAY()-7),
OR(
ISPICKVAL(StageName, 'Referral (10%)'),
ISPICKVAL(StageName, 'Pipeline (20%)'),
ISPICKVAL(StageName, 'Top Prospect (50%)'),
ISPICKVAL(StageName, 'Likely (70%)'),
ISPICKVAL(StageName, 'Commit (90%)')
)
)

Thanks,