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
Akshata ShahAkshata Shah 

DML operation

Please help me to solve this!

Create a custom object called as 'Logs'. Create a long text area field called as 'Error'.
Create 100 Lead records using DML operations having a unique name. For all records which were not inserted into Lead 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.

Thanks in advance.
Best Answer chosen by Akshata Shah
Neha AggrawalNeha Aggrawal
Hi Akshata,

You can use insert(recordToInsert, allOrNone) from https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_database.htm

The return class provides methods to get the error description: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_database_saveresult.htm#apex_methods_system_database_saveresult

With these, try writing apex class and post it here if you face any issues.

Hope this helps.
Thanks,
Neha
http://initaura.com
 

All Answers

Neha AggrawalNeha Aggrawal
Hi Akshata,

You can use insert(recordToInsert, allOrNone) from https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_database.htm

The return class provides methods to get the error description: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_database_saveresult.htm#apex_methods_system_database_saveresult

With these, try writing apex class and post it here if you face any issues.

Hope this helps.
Thanks,
Neha
http://initaura.com
 
This was selected as the best answer
Akshata ShahAkshata Shah
Thank You Neha !
dot datdot dat
Thanks a lot, it is very interesting info
Once you've found the federal defense lawyer (https://www.severolegal.com/) you want to take your case, the next step is to actually hire them.