+ Start a Discussion
Gillian PufferGillian Puffer 

"Using Formula Fields" Trailhead Challenge error/issue

In the challenge for the "Using Formula Fields" Trailhead module, I'm using the formula, TODAY()  -  LastModifiedDate, with the type set as Number (as specified in the challenge instructions, but I receive the following syntax  error: Error: Incorrect parameter type for operator '-'. Expected Number, Date, received DateTime.

I am a total admin n00b and would appreciate any feedback on the (probably obvious) element I'm missing here. Thanks!
Best Answer chosen by Gillian Puffer
Vivek DeshmaneVivek Deshmane
Hi ,
Try below and let me know if it works.
TODAY()  - DATEVALUE(LastModifiedDate)

https://help.salesforce.com/htviewhelpdoc?err=1&id=customize_functions_a_h.htm&siteLang=en_US
Best Regards,
-Vivek

All Answers

Vivek DeshmaneVivek Deshmane
Hi ,
Try below and let me know if it works.
TODAY()  - DATEVALUE(LastModifiedDate)

https://help.salesforce.com/htviewhelpdoc?err=1&id=customize_functions_a_h.htm&siteLang=en_US
Best Regards,
-Vivek
This was selected as the best answer
Gillian PufferGillian Puffer
Worked like a champ! Thanks, Vivek, you're a rockstar!
Vivek DeshmaneVivek Deshmane
Pleas mark as answer if it works.
Andrew EversleyAndrew Eversley
Hello All, I'm having the same issue that Gillian did. I'm using the formula that Vivek provided " TODAY()  -    DATEVALUE(LastModifiedDate) " but its been met with this error 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???
Gillian PufferGillian Puffer
Hey Andrew,
I ran into this too! Turns out, I was using the wrong field. The challenge asks for "Account’s Last Activity Date," and I was using the last modified date. Try playing around with that, and you'll get there. The formula Vivek sent works great, just not for that specific challenge. Have a good one!
-Gillian
 
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

Thanks,
Amit Chaudhary
Srinivas A 17Srinivas A 17
Thank you Amit.I worgly interpreted the challange as last modified date of a case instead of accounts last acitivity date.
Eli JacksonEli Jackson
It's this one: 

User-added image