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
sfdctrrsfdctrr 

How to make trigger bulk enabled to handle 2,00,000 Records

Hi Folks,


I Have a requirement like i need to import 2,00,000 records using dataloader and there is already a trigger and i need to make this trigger bulk enabled which is enough to handle 2 Lakh records.

 

1. insert/update 2,00,000 records


2.Trigger should be quite enough to handle morethan 2,00,000 which are imported through Datalaoder.


Here i'm thnking about constrints like List,DML.

 

1.List Can handle only 1000 elements at a time, so How should we handle list here.


2.The mAximum number of DML(insert/update) at a time is 10,000 so How should we handle list here.

 

What is the best way to do that Any examples with code appreciated.

 

Thanks in advance.

sfdcfoxsfdcfox

Transactions are broken down into batches of 200 records at once. You are not inserting 1 transaction of 2,000,000 records, but instead 10,000 transactions of 200 records. Your trigger needs only to accommodate a maximum number of records as will be handled by a single transaction.

 

List<T> no longer has a maximum size (1,000 was the old limit). The DML row limit of 10,000 applies to each transaction of 200 records, not to all 2,000,000 records.