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
Priyanka DumkaPriyanka Dumka 

There is Batch Class running and 1 record Not processed. What are possibilities

There is Batch Class running and 1 record Not
processed. What are possibilities
Best Answer chosen by Priyanka Dumka
VinayVinay (Salesforce Developers) 
Hi Priyanka,

Do you see any error?  Below are few details to handle error records in Batch apex.
  • Have your batch class implement Database.stateful
  • Declare some variables that are initialized in the constructor to 0. These variables count successes and errors; also a string variable that remembers the records that failed and why (initialized to empty string).
  • Use Database.update with allOrNothing = false instead of update within execute(). Interrogate each member of Database.SaveResult[] for isSuccess() and count succcesses and failures in your stateful variables from #2. Log in the stateful variable all the errors (id of record, name of record, and error message/exception)
  • In the finish method, send an email to the sysad of count of successes/failures + string variable of all the failures.
  • In finish() method, write your batch results to a custom Log__c record(s)
https://help.salesforce.com/s/articleView?id=000387981&type=1

Please mark as Best Answer if above information was helpful.

Thanks,

All Answers

VinayVinay (Salesforce Developers) 
Hi Priyanka,

Do you see any error?  Below are few details to handle error records in Batch apex.
  • Have your batch class implement Database.stateful
  • Declare some variables that are initialized in the constructor to 0. These variables count successes and errors; also a string variable that remembers the records that failed and why (initialized to empty string).
  • Use Database.update with allOrNothing = false instead of update within execute(). Interrogate each member of Database.SaveResult[] for isSuccess() and count succcesses and failures in your stateful variables from #2. Log in the stateful variable all the errors (id of record, name of record, and error message/exception)
  • In the finish method, send an email to the sysad of count of successes/failures + string variable of all the failures.
  • In finish() method, write your batch results to a custom Log__c record(s)
https://help.salesforce.com/s/articleView?id=000387981&type=1

Please mark as Best Answer if above information was helpful.

Thanks,
This was selected as the best answer
Priyanka DumkaPriyanka Dumka
The reason could be  the record got deleted or user has no permission to that record .
Please correct me if am wrong .