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
Brandon_BertrandBrandon_Bertrand 

Trailhead: Using Formula Fields

Trying to do the above trailhead module (https://developer.salesforce.com/en/trailhead/point_click_business_logic/formula_fields#challenge)
I have a formula field returning text with the following formula:
IF( TODAY() > Brandon__SLAExpirationDate__c , 'true', 'false'  )

I have tested it on an account and when the SLA Expiry date  is in the past it shows true and when it is in the future it shows false.

When I check the challenge I get the following error
An account with an SLA date in the past returned an SLA expired of false (it should return true).

I have also tried with returning a checkbox.

Am I misunderstanding the requirements?
Best Answer chosen by Brandon_Bertrand
Brandon_BertrandBrandon_Bertrand
I Deleted the field and recreated it picking checkbox from the begining and pasted my code and it worked.

Looks like Trailhead Training modules didn't like it that i change it to checkbox after i had created the formula field.

All Answers

Sumitkumar_ShingaviSumitkumar_Shingavi
1. You should be selecting "Checkbox" as return data type on formula
2. Put formula as IF( TODAY() > Brandon__SLAExpirationDate__c , true, false)

[true / false are not as Text but should be as value]

PS: if this answers your question then hit Like and mark it as solution!
AmulAmul
Is this Brandon__SLAExpirationDate__c field data type is Date type or Date/time type?
please confirm
AmulAmul
IF( StakkonForce__Expiration_Date__c<TODAY(),'true','false' )

this formula is working perfectly for Date type field. 
Brandon_BertrandBrandon_Bertrand
Sumitkumar
I have tried that, and have put it back to that and the check is still failing.

Amul

Brandon__SLAExpirationDate__c is set as a Date type
Brandon_BertrandBrandon_Bertrand
It works properly If I test it manually with an account in my Dev Org but it is not working if I press the check challenge button.
AmulAmul
Where is this check challenge button? Is this java script button you have created?

Please mail me at amulhai@gmail.com
 
Brandon_BertrandBrandon_Bertrand
I Deleted the field and recreated it picking checkbox from the begining and pasted my code and it worked.

Looks like Trailhead Training modules didn't like it that i change it to checkbox after i had created the formula field.
This was selected as the best answer
Marc D BehrMarc D Behr
I was having a similar issue with this challange and I found that the problem was that the 'SLA Expiration Date' field itself was not visible to anybody (via field level security) so the checkbox formula could would not function. Marking 'SLA Expiration Date' as Visible to all profiles solved the issue. Also, since the field is a checkbox, there is no need for the IF statement in the formula. Just a simple "SLAExpirationDate__c < TODAY()" will do the job.
Thiyagarajan GopalakrishnanThiyagarajan Gopalakrishnan
Even I am facing the same issue for SLA Expiration date. Trialhead Moderator - Kindly have a look or answer this question.
Mike HelvyMike Helvy

Hi Guys,.. I too and having a challenge here.. as I keep getting the following error message: 

Challenge not yetcomplete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Return true if the SLA has expired, and false if it has not: []

I was able to incoporate the following formula ...."SLAExpirationDate__c < TODAY()" under my new "SLA Expired" account custom field

Question: Do in need to add an  IF Statement formula under my "SLA Expiration Date" Account Custom Field as well?