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
ashish jadhav 9ashish jadhav 9 

How can I trace failed record in batch apex?

During any DML operation if a job gets failed, how can I trace the failed fields or get the log?
Sujit Anil NirkheSujit Anil Nirkhe

Hi Ashish,
You can use Database.SaveResult's isSuccess propert to check DML failure.

For more info :https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_database_saveresult.htm

You need to create records of Error object whenever DML is failed for record in batch.