You need to sign in to do that
Don't have an account?

Database batchable scope limit
Hello everyone,
In a database batchable...How do I put a 5 records limit to the scope?
global void execute(Database.BatchableContext info, List<Contact> scope)
Thanks in advance!
Hi,
You can set the scope when you are exceuting the batch by creating it's object.
For example:
Id batchId = database.executeBatch(new SL_Batch_Contact(), 5);
where SL_Batch_Contact is my class name and 5 is my scope.
It will be processing only 5 records in one batch.
Thanks,
nicks1505
Certified Developer
All Answers
Hi,
You can set the scope when you are exceuting the batch by creating it's object.
For example:
Id batchId = database.executeBatch(new SL_Batch_Contact(), 5);
where SL_Batch_Contact is my class name and 5 is my scope.
It will be processing only 5 records in one batch.
Thanks,
nicks1505
Certified Developer
Thank you Nick, It's really easy but I didn't know how to do It
Regards,
Welcome!
Glad that it helped you:-)