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
PavanReddyPavanReddy 

how many times satart and finish methods calls in batch apex?

Bhawani SharmaBhawani Sharma
Only one time. When you write database.executeBatch statement, It execute start methid. After the execute method invoked and then finish method. Execute method depends on your batch size. Like if your batch size is 200 and your database has 1000 records, it will be called 5 times. But start and finish will be called only one.
souvik9086souvik9086

Hi,

 

The start method is called at the beginning of a batch Apex job. Use the start method to collect the records or objects to be passed to the interface method execute.

It is called only one time and passes all the records to execute. Then execute method execute the records according to the chunk of data you mention in the batch.

 

The finish method is called after all batches are processed one time as well.

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

 

PavanReddyPavanReddy

thx sovik

PavanReddyPavanReddy

thx bhawani

Bhawani SharmaBhawani Sharma
Hi Pavan, Please mark this as resolved whatever solution worked for you. It will help others.