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
Enrique Pasos 8Enrique Pasos 8 

How do I report on past 24 hours

I want to pull a report showing new records created in the last 24 hours.  I tried using the following in a formula field (text) 

IF ( NOW() - CreatedDate < 1 ,"TRUE", "FALSE" )

But I get the error message 

"Error: Field CreatedDate may not be used in this type of formula"

Any help is appreciated.
Best Answer chosen by Enrique Pasos 8
Maharajan CMaharajan C
Hi Enrique,

Please use the below link for your reference it will help you:

http://christopheralunlewis.blogspot.com/2011/11/how-to-create-past-24-hours-flexible.html

Thanks,
Maharajan.C

All Answers

ApuroopApuroop
Are you trying to create a report or just query the records?
Enrique Pasos 8Enrique Pasos 8
Trying to create a report.   My approach is to create a field on the object which is true/false if the record is within 24 hrs.  Then I can use that as criteria for the report.
Maharajan CMaharajan C
Hi Enrique,

Please use the below link for your reference it will help you:

http://christopheralunlewis.blogspot.com/2011/11/how-to-create-past-24-hours-flexible.html

Thanks,
Maharajan.C
This was selected as the best answer
ApuroopApuroop
Try this,
 
IF((DATEVALUE(NOW()) -  DATEVALUE(CreatedDate))*24*60 < 1440, true, false)
Enrique Pasos 8Enrique Pasos 8
Thanks Everyone.  It works!