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
merrick devillemerrick deville 

Trailhead validation Closed date error

On the using basic in checking Formula challege. I have done the challege and tested the results but I cant get it to validate that its correct. I have re written the formula Multiple times now and everytime when I test it the validation fires as expected. But I can get it to validate through trailhead. I get the following error.

"Challenge Not yet complete... here's what's wrong: 
The validation rule does not reference the 'IsClosed' and 'CloseDate' fields correctly. Take a look at the requirements again."

Here is the challenge:

Your number-crushing sales team has so many deals in the pipeline, you’re starting to see occasional problems with data quality. Namely, sales reps are forgetting to update the close date to a date in the future. Make a formula that requires an opportunity to have a CloseDate of today or any future date. Hint: this formula should reference the hidden IsClosed checkbox field on the Opportunity object, and you will be creating the formula as an Opportunity validation rule.The validation rule should be on the Opportunity object
The validation rule should be named 'Close_Date_Alert'
The validation rule should fire if IsClosed is not selected and CloseDate is yesterday or earlier
The validation rule should display the error 'Hey McFly, unless you are planning to go back in time, please update your close date' at the top of the page when triggered


Here is the formula I currently have in there:


CloseDate < TODAY() && NOT(IsClosed)

I have probably written this like 10 diffrent ways and cant get it to properly validate.


 
Best Answer chosen by merrick deville
merrick devillemerrick deville
This work my formula worked fine. There was an issue at the time with the Trailhead validator. They saleforce team resolved it on another discussion topic.

All Answers

Ricardo DiazRicardo Diaz
Hey Merrick - are you sure you are creating this as a Validation Rule and not as a Formula field?
RudrarajuRudraraju
Hey Merrick,

Try this one : AND(CloseDate < TODAY(), NOT(IsClosed))
Patrick Jones 5Patrick Jones 5
Can anyone tell me about the "hidden IsClosed checkbox field on the Opportunity object" ??
I can make this challenge work, but I am unable to finde this field on the object.
merrick devillemerrick deville
This work my formula worked fine. There was an issue at the time with the Trailhead validator. They saleforce team resolved it on another discussion topic.
This was selected as the best answer
merrick devillemerrick deville
Patrick,

IsClosed Path
Patrick Jones 5Patrick Jones 5
Hi Merrick, the formula works fine for me too.  I am just unsure about where the "IsClosed" field is on the Opportunity object.  I can't see it on fields related list.  Can you?
merrick devillemerrick deville
Its controlled directly by the stage name its in the API but not an actaual field that you can put on the layout.

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_opportunity.htm




IsClosedType
boolean
Properties
Defaulted on create, Filter, Group, Sort
Description
Directly controlled by StageName. You can query and filter on this field, but you can’t directly set it in a create, upsert, or update request. It can only be set via StageName. Label is Closed.
Patrick Jones 5Patrick Jones 5
Great, thanks!  I can find it via the formula editor now.  But I still don't understand how it is "hidden" - is this some type of SF standard hidden field?
Patrick Jones 5Patrick Jones 5
Thanks again!  You are answering faster than I can ask questions.
merrick devillemerrick deville
For a lack of better terms it is Hidden by SF Design. Since its driven off the stage name 100%. They do not want anyone including admins from being able to update that field without changing the stage name.  In the other link you will see you can only query that value you can’t update or insert that value without changing the stage. 
 
Sindhura ManthapuriSindhura Manthapuri
I get this weird error, 
There was an unhandled exception. Please reference ID: VOCEZBQM. Error: Faraday::ClientError. Message: UNKNOWN_EXCEPTION: An unexpected error occurred. Please include this ErrorId if you contact support: 78580668-118275 (-1792630010)

Condition i used: AND(CloseDate < TODAY(), NOT(IsClosed))
Adri SzopianAdri Szopian
I passed the challenge with: 

IF( 
IsClosed, 
CloseDate < TODAY(),
TRUE 
)

If the Opportunity has been CLOSED 
and the Closing Date is before TODAY (any previous date before today),
than the the statement becomes TRUE
and this will trigger the validation rule to fire,
and it won't allow to save the file.
Kinga LesinskaKinga Lesinska
You could also use: 
AND(
NOT (IsClosed)
 &&  CloseDate < TODAY() 
)
Chandan HSChandan HS
Hi merrick,

Make sure you are using validation rule and not Formula field 
Please use the simple for formula to meet the given criteria

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

AND(CloseDate < TODAY(), NOT(IsClosed))
Umesh Pawar 9Umesh Pawar 9
It works for Me thanks 
Umesh BhadouriaUmesh Bhadouria
Use this validation rule
AND(CloseDate < TODAY(), NOT(IsClosed))
 
Tushar Choudhary 4Tushar Choudhary 4
AND(CloseDate < TODAY(), NOT(IsClosed))
Widson M MashamaiteWidson M Mashamaite
My formular worked wonders as follows:-

AND ( IsClosed <> TRUE , CloseDate < TODAY() )
STEFANO BAZZOLISTEFANO BAZZOLI
after 1 hour of unsuccessful tests I passed the challenge only by changing the playground (sigh)
 
Megs RamtekeMegs Ramteke
AND(NOT(IsClosed), CloseDate < TODAY() ) 
try this one...it will definitely work.....
Kishore Bagathi 1Kishore Bagathi 1
It worked only after changing my Playground and using the same formula which failed in the former ground. Salesforce team shall focus on fixing this issue, as I see, this has been persistent since many years.. Thanks..
Emmanuel ODUEmmanuel ODU
This need to be looked into, Worked with the same formula AND(NOT(IsClosed), CloseDate < TODAY() )  in a new Playgroung after so much time troubleshoting in my main Playgroung
Riccardo MiglioRiccardo Miglio
Hi everyone, just to confirm that the AND(NOT(IsClosed), CloseDate < TODAY() ) formula on the validation rules is accepted by Trailhead validation only changing the former playground (i was usind the "classic" My Trailhead Playground 1; however, in this playground, the message appeared correctly on the opportunity record). 
Ahmed Aly 9Ahmed Aly 9
Try creating a new playground, fixes the issue.