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
Shruti VishShruti Vish 

Soql to fetch the one year older data from object

I want to delete the records which one year older 
Ahmad J. KoubeissyAhmad J. Koubeissy
if you want to consider the createdate, so you delete all the data not created this year:
- open the Developer Console and go to execute anonymous and write the following code:
delete [select id from object where createddate != this_year];
If you want to delete the records not last modifed this year: 
delete [select id from object where lastmodifieddate != this_year];

If you want to delete all the records not modified this year and not created this year:  
delete [select id from object where lastmodifieddate != this_year and createddate!= this_year];

Kindly mark as best answer if this solves your question