+ Start a Discussion
Raj R.Raj R. 

How to insert, delete, and update 50,000+ records using a trigger?

Here is the scenario:
• 50,000+ Accounts exist in the system
• The Account fields need to be copied over to a custom object(that is linked to its respective Account)
• A trigger can be used to insert, delete, and update records through the Sf user interface
 
I need to figure out a way to create 50, 000+ custom object records through a schedulable batch Apex class. Any ideas other than using Data Loader?
Best Answer chosen by Raj R.
Damien Phillippi033905702927186443Damien Phillippi033905702927186443
I think you have some confusion in your terminology... or about what you are saying.  That said, you can use an Apex batch for this.  It can query far more than 50k records and execute on them.  When batches execute, they execute on only 200 records at a time so you won't be hitting governor limits by using the batch.