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
Javier CGJavier CG 

Massive cloning of records in different object

My customer has a custom object with more than 5 millions of records what need to export to an external application monthly. He doesn´t need to export all of them, only the last year records (about one million of records), but the export process doesn´t let filter the records, it export all the records of the linked object.
The idea is to clone the object in another custom object exactly the same, export the correct records monthly, and link the export process to this new object.
But I don´t know how to clone the requested records of the original object to the new object with an Apex class without exceeding the governor limits.
Any ideas of how to do it or another way to getting my objective?

Thank you in advance
OFröhlichOFröhlich
Hi,
why doesn't you use the salesforce dataloader or workbench to export the data.?There you can filter the data you need.
With dataloader you can create for example batch files, which can be scheduled.
Cloning the data should not be the preferenced solution.
Javier CGJavier CG
I can´t use data loader because the process must be launched by a user without data loader access and the execution can´t be scheduled because the user must execute the process depending on the execution of another business processes, then the execution time cant be predicted.
I know that cloning too much records number is not the best solution, and I will try to find another way to do it when the customer explains to me the full process, but now, with these conditions, an Apex class is my best choice.