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
Animesh DattaAnimesh Datta 

get records created 30 days ago

Hi,
I am working on a batch class to delete records created 30 days ago.
using the below query but it is not working. Kindly help.

Regards,
Animesh
select id from BU_Monitors_Opportunity__c where CreatedDate < system.today().addDays(-30)

 
Best Answer chosen by Animesh Datta
NagaNaga (Salesforce Developers) 
Hi Animesh,

The only difference in the below link is they have deleted the records based on the "last modified date", you have to apply it for "created date"

https://developer.salesforce.com/forums/ForumsMain?id=906F00000009357IAA

The only difference 

User-added image

Please let me know if this helps

Best Regards
Naga Kiran