I'm going to write a daily scheduled apex class. I have a couple of questions about the governor limit:


> Account acct = new Account(name='test account');
>         insert acct;
>         Contact[] contactsToCreate = new Contact[]{};
>         for(Integer x=0; x<1000;x++){
>             Contact ct = new Contact(AccountId=acct.Id,lastname='test');
>             contactsToCreate.add(ct);
>         }
>         insert contactsToCreate;

So i will have just 1DML for 1000 records (salesforce limit is 150 DML instructions) which is the size limit for a list(like contactsToCreate) for an insert () DML statement?

2)for (List<Account> accts : [select name from Account])

is there some limit about the number of record that i can manage with a for loop like the above?

Thanks in advantage for any advice. BR

1 Answer 1

  1. The limit is 10,000

  2. The for loop batches the results, so you are really limited by the max return of the SOQL query which is 50,000

Hope this helps




You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .