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
PRADEEP KUMAR 438PRADEEP KUMAR 438 

How do we know the count of successful batches and count of failure batches in batchapex

JayantJayant
AsyncApexJob a = [SELECT Id, Status, NumberOfErrors, JobItemsProcessed, TotalJobItems, CreatedBy.Email FROM AsyncApexJob WHERE Id = :BC.getJobId()]

Do similar query in finish() method, BC is the instance of BatchableContext. NumberOfErrors is the number of failed batches and subtract it from JobItemsProcessed to get the number of successful batches.
laxmi narayan 11laxmi narayan 11
Hi PRADEEP KUMAR 438,

Going to Setup > Quick find/Search box > Apex job

Here you can see Total batches and Batches Proccessed, if all batches are processed properly, this is called all batches are running sucessfully. On the other any batch failure it will show you failure list.

Thanks