Suggested answer

DML statements (insert records;): If any record in the batch fails, the entire operation is rolled back and an exception is thrown. All or nothing. Database methods (Database.insert(records, false);): The second parameter allOrNone — when set to false, allows partial success. Records that pass validation are committed; failed records are captured in Database.SaveResult. Returns a list of SaveResult objects, each with isSuccess(), getErrors(), and the record Id. Use partial DML when processing a batch where some records may legitimately fail and you want to continue processing the rest. Use allOrNone DML when data integrity requires all records to succeed together (transactional requirement).

Practice content for interview preparation; not an official vendor answer. Verify details against current product documentation.

Community comments (0)

No comments yet.

Sign in or create a free account to add a comment. Comments are moderated before they appear.

Plain text only, 3–2000 characters. A moderator reviews every comment before it is published.