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
penchala rajupenchala raju 

what is bulkifying dml

pconpcon
Bulkifying dml more deals with making sure that you do not do DML inside of loops.  For example

BAD
for (Account account : accountList) {
    insert new Contact(
        AccountId = account.Id
        LastName = 'tester'
    );
}

BETTER
List<Contact> contacts = new List<Contact>();

for (Account account : accountList) {
    contacts.add(new Contact(
        AccountId = account.Id
        LastName = 'tester'
    ));
}

insert contacts;