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
Abilash.SAbilash.S 

Apply logic on particular records in batch apex

Hi team, I have experienced one of the  interview question like this. Can u help me.
Q) We have a Batch class on object, Here we are processing some logic on 5 records saying batch size-1.
     
     There is an error in 4 and 5 records, How do you find the errors.
     And i want that errors to be mailed once the process is done.
ShirishaShirisha (Salesforce Developers) 
Hi Abhilash,

Greetings!

You can write the code in the finish method to get the notifications on job failure.Otherwise,you can check the failure on the View details on UI as well.

Please find the sample code in the below document:

https://developer.salesforce.com/forums/?id=906F0000000BKaPIAW

Please mark it as best answer if it helps you to fix the issue.

Thank you!

Regards,
Shirisha Pathuri