Certified Platform Developer II Exam QuestionsBrowse all questions from this exam

Certified Platform Developer II Exam - Question 37


Which statement should be used to allow some of the records in a list of records to be inserted if others fail to be inserted?

Show Answer
Correct Answer: B

To allow some of the records in a list to be inserted if others fail, the Database.insert method should be used with the allOrNothing parameter set to false. This ensures that even if some records fail validation or insertion due to errors, the records that are valid and error-free will still be inserted. Therefore, the correct statement is Database.insert(records, false).

Discussion

4 comments
Sign in to comment
karappoOption: B
Feb 15, 2023

https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_database.htm#apex_System_Database_insert

costansinOption: B
Feb 22, 2023

Then B

M4JK3LSONOption: B
Dec 19, 2023

B - second argument is allOrNothing - when set as false successfully validate records can be save. If arguemnt is true - them at least one failed is enough to rollback whole transaction

Jeet89123Option: B
May 29, 2024

allornone set to False