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.

Syntax:

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

Sample:

AccountUpdate au = new AccountUpdate();
Database.executeBatch(au,1500);

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.

Cheers!!!

No comments:

Post a Comment