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
Rizwan Ali 8Rizwan Ali 8 

The validation rule should fire if IsClosed is not selected and CloseDate is yesterday or earlier

Create a validation rule indicating whether an opportunity has a closed date in the past.
User-added image 
Please anyone tell me this Formula?
Best Answer chosen by Rizwan Ali 8
Khan AnasKhan Anas (Salesforce Developers) 
Hi Rizwan,

Greetings to you!

Make sure you are using validation rule and not Formula field. Try this:
 
AND(
   CloseDate < TODAY(), 
   NOT(IsClosed)
)

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas

All Answers

Khan AnasKhan Anas (Salesforce Developers) 
Hi Rizwan,

Greetings to you!

Make sure you are using validation rule and not Formula field. Try this:
 
AND(
   CloseDate < TODAY(), 
   NOT(IsClosed)
)

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
This was selected as the best answer
Ajay K DubediAjay K Dubedi
Hi Rizwan,

Create a validation rule indicating whether an opportunity has a closed date in the past follow these steps

Click on object manager then select Opportunity Object.
Click on validation rule.
Then click on the New button to create validation rule.
Fill these input field
Rule Name: = Close_Date_Alert
Error Condition Formula:= AND(NOT(IsClosed), CloseDate< Today())
Error Message:= Hey McFly, unless you are planning to go back in time, please update your close date' at the top of the page when triggered

Then click on the save button and after that click on the clon button.

User-added image

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi


 
Rizwan Ali 8Rizwan Ali 8
Thanks alot Both 
It Worked
Beau MoyaBeau Moya
This validation rule works for initial close date change BUT not if they edit after. How do I get the validation to fire upon any edit to the Closed Date field? Thanks.
Lisa Caroselli 21Lisa Caroselli 21
Not sure if it's possible to answer this, but I used a different formula that validated but it didn't satisfy the challenge-- why does this formula do the trick?
Stefan Georgiev 8Stefan Georgiev 8
After 30 min searchign for what is preventing for the challenge to be complete, I found out that you probably use old organization which has a Discount Percenmt custom field which is mandatory and the program does not populate it, so the opp could not be created. Delete or make sure that the field is not mandatory 
Alyssa OhAlyssa Oh
Stefan Georgiev was correct. Under the Discount Percent custom field, I unchecked the "required" box, and the validation rule solved the challenge. Thank you! 
Emin HuseynovEmin Huseynov
I also unchecked the required box under the Discount Percent, and it worked for me. Thanks, Stefan!
User-added image
Thabit HamrorThabit Hamror
Thanks @Stefan Georgiev - I had put down the correct formula which is very straightforward to be honest but couldn't pass the challenge, so kept on trying to find where the issue is. Finally I saw your post and did as you advised, I unchecked the 'required' box in the Discount Percent field - now the opportunity is created and the challenge is passed.
Vivek Singh BishtVivek Singh Bisht
I had the same problem, unchecking the percent discount solved the issue.
Jamie ColpeanJamie Colpean
Seriously....this should be corrected by the staff....I wasted so much time on this...and I bet this has a very negative effect on new formula learners when this is their very first exercise and it is continual failure.
Vivek BangalVivek Bangal
Hey folks,

For the creation of the validation rule, select the validation rule on the Opportunity object and not the formula.

Use the below logic,
AND(NOT(IsClosed), CloseDate    <  TODAY()   )

Save the validation rule, also note at the time of saving it would check the discount percent too while creation of opp, so navigate to field Discount under object Opportunity and untick the required field, this would allow saving opportunity with no discount too.

I hope this solves the query.
Emmanuel SylligardakisEmmanuel Sylligardakis
Somebody should fix this, i wasted also a lot of time!
Tony Williams 27Tony Williams 27
Stefan Georgiev was spot on with unchecking the required box under discount percent.  Saved me a lot of time.  Thanks
Stanislav ValkovStanislav Valkov
Thanks for this WA. It is a pitty that after so many years SF didn't fix it.
Alejandro F.Alejandro F.
I faced a hiccup in my Admin Advanced lesson https://trailhead.salesforce.com/content/learn/modules/advanced_formulas/checkbox_logic_formulas?trail_id=force_com_admin_advanced, which seems to present the same exact challenge. I would get a message saying:

Challenge not yet complete in Cunning Goat Playground
We tried to create an opportunity with tomorrow as the CloseDate, but we couldn’t. Make sure the validation rule fires only when the CloseDate is in the past.


The formula under my validation rule (for an Opportunity) is 
Not(IsClosed) && CloseDate < TODAY()

Oddly enough, trying the same at a different playground, did work. I've been finding intermittent error messages when validating a hands-on challenge that won't come up if trying the same answer through a different playground. 

I hope this helps someone facing similar issues.