How to Chain Batch Jobs in Salesforce
First of all, we need to understand why do we need to chain the batch jobs?
Lets take an example:
We have two requirements to do in code. First we need to delete all the contacts and then insert the new contacts received from Integration. In this case, we can have two batch jobs. First job will delete the contacts and then second job will insert the new contacts.
In other words, Chaining jobs is useful if your process depends on another process to have run first.
Call another batch in finish method so that all the processing of first job is completed and system will have the updated data before the second job.