Query records created Today or Yesterday in SOQL

You can easily Query records created Today or Yesterday or which are Last Modified Today or Yesterday. No need to jump on dates and making dynamic queries to create the current date or yesterday’s date. You can even query records whose closedate is Tomorrow. Salesforce provides an easy way to query it. For this, you just need to append TODAY or YESTERDAY or TOMORROW in your WHERE clause of the query.

Salesforce provides so many Date Literals to directly use in your query. Check Here.

Check out these examples for easy understanding.

Accounts created Today:

 

Account Last Modified Today:

 

Opportunities whose CloseDate is Tomorrow:

 

Records created Yesterday:

 

Records Last Modified Yesterday:

 

Accounts created Yesterday AND Modified Today:

 

Accounts either created Yesterday or Today:

 

Also Check:

For any queries or suggestions, comment below.

Cheers … Happy Coding … 🙂

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments