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
Robert Wambold 10Robert Wambold 10 

How to count EmailMessage records created in the last hour? Syntax Issue

Hello All,

I am trying to get a  of EmailMessage records created in the last hour?

For some resaon it does not like my System.debug statement...any idea? 

User-added imageThanks for your help in advance!

Robert

 

 

Best Answer chosen by Robert Wambold 10
AnudeepAnudeep (Salesforce Developers) 
Can you hardcode the date value in your SOQL and confirm if you still see the error?

try using a hard coded value like this
 
WHERE CreatedDate > 2014-06-28T22:01:02.000Z

If you still experience the issue, then it must be an issue with the syntax. You might want to initialize the EmlLst first 
 

All Answers

AnudeepAnudeep (Salesforce Developers) 
Can you hardcode the date value in your SOQL and confirm if you still see the error?

try using a hard coded value like this
 
WHERE CreatedDate > 2014-06-28T22:01:02.000Z

If you still experience the issue, then it must be an issue with the syntax. You might want to initialize the EmlLst first 
 
This was selected as the best answer
Robert Wambold 10Robert Wambold 10

Initializing the List did the trick. 

Thank you!