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
Vaibhav BabrekarVaibhav Babrekar 

Can anyone help me out with solution for this requirement

Create a custom object called as 'Logs'. Create a long text area field called as 'Error'. Create 100Lead records using DML operations having a unique name. For all records which were not inserted intoLead object, insert a record in Log object along with the reason why a record was not inserted. Also,execute assignment rules to auto allocate Lead records to correct owner.
PriyaPriya (Salesforce Developers) 
Hey Vaibhav,

Kindly refer these links which help you to capture the error in custom object:- 
1. Blog :- https://www.biswajeetsamal.com/blog/salesforce-custom-object-to-save-logs/

Some relevent scenarios :-
2. https://salesforce.stackexchange.com/questions/212406/throw-error-message-and-capture-it-in-error-log-custom-object (https://developer.salesforce.com/forums/?id=906F00000008wl3IAA)


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

Kindly mark it as the best answer if it works for you.

 

Thanks & Regards,

Priya Ranjan


 
mukesh guptamukesh gupta
HI Vaibhav,

Blelow url will help for your solution:-

https://salesforcecodex.com/salesforce/exception-logging-in-custom-object-salesforce-apex/

if you need any assistanse, Please let me know!!

Kindly mark my solution as the best answer if it helps you.

Thanks
Mukesh