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
Andrew EversleyAndrew Eversley 

"Using Formula Fields" Trailhead Challenge error/issue Revisited


Hello All, I'm having an issue with the Using Formula Field Challenge . I'm using the formula that Vivek provided to a solved question yesterday " TODAY()  -    DATEVALUE(LastModifiedDate) " but its been met with this error below when its been checked by the challenge " 

Challenge not yet complete... here's what's wrong: 
The 'Days_Since_Last_Update__c' formula field did not return the correct number of days between an Account’s Last Activity Date and today

Can anyone assist???
Best Answer chosen by Andrew Eversley
Andrew EversleyAndrew Eversley
This is the formula that worked for me (Today()- Account.LastActivityDate)
Thanks to you all for you quick responses and input guys. Appreciate it.

All Answers

Andrew EversleyAndrew Eversley
Just wanted to add the criteria I was asked to work with for the challenge. 

The formula should be on the Case object.
The formula should be of return type Number.
The formula should be named 'Days Since Last Update' and have a resulting API Name of 'Days_Since_Last_Update__c'.
The formula should return the number of days between the account’s Last Activity Date and today.

Just for the record I add the formula on the Case object and not the Account object. Should I have added the formula to the Account object because it seems from the error that the account is what is being tabulated. Please advise.
Vivek DeshmaneVivek Deshmane
Hi Andrew,
Please try below formula and let me know if it works.
TODAY()  - DATEVALUE(LastActivityDate)

Best Regards,
-Vivek
Andrew EversleyAndrew Eversley
Thanx for the response Vivek, now should this be on the case object or the account object? I've just created a formula on the account object and was about to test it.
Andrew EversleyAndrew Eversley
The Check syntax comes back with the error ( Error: Field LastActivityDate does not exist. Check spelling.)
Amit Chaudhary 8Amit Chaudhary 8
Hi Andrew,

Please try below code
(Today()- Account.LastActivityDate)
User-added image
Same worked for me

Pleas elet us know if this will help u

 
Amit Chaudhary 8Amit Chaudhary 8
Hi Andrew,

Please create one formula field with Number type on case object like below 
(Today()- Account.LastActivityDate)
Please refer below screen shot. I hope that will help you
User-added image


Same worked for me

Pleas elet us know if this will help u
 
Andrew EversleyAndrew Eversley
This is the formula that worked for me (Today()- Account.LastActivityDate)
Thanks to you all for you quick responses and input guys. Appreciate it.
This was selected as the best answer
Sudha Kundathil MohananSudha Kundathil Mohanan
Hi Andrew,

where did did up create the formula?Did u create a custom object called 'Account'? Or in the custom object 'Case'?
Sudha Kundathil MohananSudha Kundathil Mohanan
In the insert field, I don't have Account listed in the Case Object formula field.
Sudha Kundathil MohananSudha Kundathil Mohanan
Hi Amit

I already tried the above formula in Case object but I got a syntax error

 Error: Field Account does not exist. Check spelling.
I understand the Account object needs to made accessible to the Case object somewhere.but don't know where.

Thanks
Sudha
Mark BrintonMark Brinton
Everytime I click "Check Challenge " This comes up: 
Challenge not yet complete... 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: REQUIRED_FIELD_MISSING, Required fields are missing: [AccountID__c]: [AccountID__c]

My formula is created in Cases > Fields > Case Custom Fields & Relationships. Formula return type is a Number with the formula: (TODAY()  - Account.LastActivityDate)

Any thoughts? 
Amit Chaudhary 8Amit Chaudhary 8
Hi Mark,
It look like you created one "AccountID__c" field on case object as a required field. Please remove that field.
NOTE:- you  need to create the field on stantard object case. please check below post with step by step process
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000BQwUIAW

Please let us know if this will help u

Thanks
Amit Chaudhary
Mark BrintonMark Brinton
Yes that worked, I found out that I created another AccountID object from another (unrelated from trailhead) tutorial. 

Thank you! 

Mark
 
Andrew EversleyAndrew Eversley
This question is solved
Enrique TrepatEnrique Trepat
This formula works to pass the challenge:
Today()- Account.LastActivityDate

But it gives me an empty field on all the cases. I guess that's because Account.LastActivityDate is empty on all account records.
Ashraful Islam 19Ashraful Islam 19
I was face a problem to complete this challenge. Resolved after inactive previous created trigger.
Jason FungJason Fung
@Sudha Kundathil Mohanan No need to create a custom "Case" object because there is already a built-in "Case" page (Setup > Build > Customize > Cases > Fields) that you can use in Salesforce. From there, you can create a "Case Custom Fields & Relationships" and then create your "Days Since Last Update" formula. You are right on creating a custom "Account" object. But don't forget to create a custom "LastActivityDate" field in your "Account" object because your "Days Since Last Update" formula: "TODAY() - Account.LastActivityDate" is referencing the LastActivityDate field from your "Account" object.  

 
prabhavathi sharmaprabhavathi sharma
still i getting this error what should i do ?

Challenge Not yet complete... 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, Fax must be A999: [Fax]
 
Jess BurghJess Burgh
Hello all! I'm trying to complete this challenge and keep getting this error message.

User-added image

I'm not sure what I'm doing wrong. Help!
Pooja Gupta 54Pooja Gupta 54

Hi All,

I am getting this error though I have written the correct formula. 

Can anybody help me?User-added image

Amit Chaudhary 8Amit Chaudhary 8
It look like you in your org you have any Trigger on Account object which is creating a case object. Please deactivate that trigger and try again
Prasad Gayan Wickrama KaluthotagePrasad Gayan Wickrama Kaluthotage
@Amit Chaudhary 8 your right. i had the same probleme & solved after remove the trigger on Account object
Avinash Y 29Avinash Y 29
I got this error when trying the Use 'Formula fields' in trailhead. Today() -Last activity date challenge.

Challenge Not yet complete... 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: REQUIRED_FIELD_MISSING, Required fields are missing: [Test_GeoLoc1__Latitude__s, Test_GeoLoc1__Longitude__s, Test_Text5__c]: [Test_GeoLoc1__Latitude__s, Test_GeoLoc1__Longitude__s, Test_Text5__c]

 
Matt Williams 26Matt Williams 26
I believe most of the confusion on this error is coming from the instructions on the challenge. I followed @Amit Chaudhary 8's instructions, and placed the field on the Case object, not the Contact (as instructed), and it worked.