+ Start a Discussion
Mike HelvyMike Helvy 

Newbie Stuck : Introduction to Formula Fields Trailhead module


Create a formula field that determines if an account's SLA expiration date has expired.

For easier reporting and filtering, create a new custom formula field on the standard account object which looks at the SLA Expiration Date field and returns true if the current date comes after it. Otherwise, it should return false.The account object should have a custom date field with the Field Label 'SLA Expiration Date' and Field Name of 'SLAExpirationDate'. The resulting API Name should be 'SLAExpirationDate__c'. On a Developer Edition, the 'SLA Expiration Date' field may already exist.
The new formula field should have the Field Label 'SLA Expired' and Field Name of 'SLA_Expired'. The resulting API Name should be 'SLA_Expired__c'.
The formula field should calculate its response based on the current date.
The formula field should return true if the SLA has expired, and false if it has not.

I keep getting the following error.

Challenge not yet complete... here's what's wrong: 
An account with an SLA date in the past returned an SLA expired of false (it should return true).
Best Answer chosen by Mike Helvy
Frédéric TREBUCHETFrédéric TREBUCHET
Hi Michael,

No you don't have to do anything else with the custom field "SLA Expiration Date".
I don't know where this error message come from.
I've just tested now with my org and everything works as a charme when modifying or creating a new account.
Did you check the syntax after you have modified/created the formula using the "Check Syntax" button?
Did you check for misspelling error in the field name "SLAExpirationDate__c"?
Is the datatype of the field "SLAExpirationDate__c" correct? (ie. Date datatype)
Do you have something like this for your custom fields when you arrive on the "Account Fields" page?
Check your fields datatype
If everything seems to be OK, I suggest that you delete your 2 custom fields and try again.
Sorry, no more idea at this stage :(

Please, fill free to let me know what happens.
Fred

All Answers

Frédéric TrébuchetFrédéric Trébuchet
Hi Michael,

I suppose your formula is reversed.
Because the formula type is "Checkbox", your formula should return FALSE if the value of "SLAExpirationDate__c" is in the past - ie. SLAExpirationDate__c  <  TODAY().

Fred
Mike HelvyMike Helvy
Thanks Fred... but I'm still being challenged here.  

Not sure if this makes any sense but here are my steps.

Step 1: Confirmed SLA Expiration Date already existed in my Account Custom Fields & Relationships
Step 2: Inserted Selection Function TODAY ()  when I tried to add the "<" sign it would not let me.
Step 3: Create New Cusotm Field Click "New"
Step 4: Choose Data Type "CheckBox"  click next.
Step 5: Enter Field Label "SLA Expired' and Field Name of 'SLA_Expired'.
Step6: Click Default Value. Next , Next  Save
Step7:??
Step 8???

Thanks for the help.
Frédéric TrébuchetFrédéric Trébuchet
Hi Michael,

The field you have to create must be of type 'Formula':
Select Data Type Formula

and the Formula Return Type have to be 'Checkbox' (as your formula will return a boolean):
Formula Return Type 'Checkbox'

Then, enter the formula (use 'Insert field' button to select the field or type in its name, then the operator and finally the function - you can also select it in then list on the right of the page).
Enter the formula
Check the syntax (button under the field text).
It should works.

Hope this helps.
Fred
 
Mike HelvyMike Helvy
Thanks Fred.. That help out but now I have a new question and 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?

Thanks in advance.
 
Frédéric TREBUCHETFrédéric TREBUCHET
Hi Michael,

No you don't have to do anything else with the custom field "SLA Expiration Date".
I don't know where this error message come from.
I've just tested now with my org and everything works as a charme when modifying or creating a new account.
Did you check the syntax after you have modified/created the formula using the "Check Syntax" button?
Did you check for misspelling error in the field name "SLAExpirationDate__c"?
Is the datatype of the field "SLAExpirationDate__c" correct? (ie. Date datatype)
Do you have something like this for your custom fields when you arrive on the "Account Fields" page?
Check your fields datatype
If everything seems to be OK, I suggest that you delete your 2 custom fields and try again.
Sorry, no more idea at this stage :(

Please, fill free to let me know what happens.
Fred
This was selected as the best answer
Mike HelvyMike Helvy
You the man!! Thanks Fred . I deleted both fields and that worked!

 
Frédéric TrébuchetFrédéric Trébuchet
You're welcome !
Cynthia B StoneburnerCynthia B Stoneburner
Thank you, this helped me also! I did not mean to thumbs down the above comment! oops! 
Peter LantzPeter Lantz
Thanks all, I'm really new at coding and this helped a ton!