You need to sign in to do that
Don't have an account?
Rohit Vaidya 3
Batch call from finish
Can an another batch is called form execute and finish method? especially can we call a new batch from finish method in batch apex
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
The execute method cannot be used to call a batch. Another batch may be called using the start and finish method.
For example, you can call another batch in the finish method using this approach.
Please mark it as best answer if it helps you.
Thanks
Based on https://www.biswajeetsamal.com/blog/invoke-batch-apex-from-another-batch-apex/ , Only in batch class finish method, we can call another batch class. The reason for this is that the execute() method will be called many times for a given batch start() and this can get out of hand with too many batches scheduled. If you will call another batch class from batch class execute and start method, then Salesforce will throw runtime error- System.AsyncException: Database.executeBatch cannot be called from a batch start, batch execute, or future method.
Also see this related discussion
https://salesforce.stackexchange.com/questions/53740/system-asyncexception-database-executebatch-cannot-be-called-from-a-batch-start
If this information helps, please mark the answer as best. Thank you