How to limit number of records to be processed per transaction in Batch Apex?

The Database.executeBatch method takes an optional parameter scope. This parameter specifies the number of records that should be passed into the execute method.


Database.executeBatch(instance of batch class,scope);


AccountUpdate au = new AccountUpdate();

The limit for scope parameter is 2000.

The default value is 200.

If the scope value is greater than 2000, it will consider as 2000 and then process.


No comments:

Post a Comment