+ Start a Discussion
Anuj Thakur 4Anuj Thakur 4 

I have to process 10k records via batch as per below scenario, need help on this

Hi All,
I have a scenario where I have to process lets assume 10000 records through Batch class. lets say in first time only 5k records has been processed and 5k has been failed. now 2nd time i processed 5k records among those 2 k failed and 3k succeed. in the same manner I have to process all records in 5 times. 
I have below approche to solve this.
1. we can use counter variable and run the batch five times based on counter variable untill the records processed.
2. we can use Database.saveResult and keep the failed records in a list and process those failed records again.
But the person who asked me this question he said there is something else you can do here. Is there any salesforce built in functioanlirty or any API to handle this type of scenario.
can you please explain if anyone aware of it.

Thanks,
Anuj