Salesforce
PDII · Question #192
A developer is inserting, updating, and deleting multiple lists of records in a single transaction and wants to ensure that any error prevents all execution. How should the developer implement error…
The correct answer is A. Use Database.setSavepoint() and Database.rollBack() with a Try/Catch statement. See the full explanation below for the reasoning.
Question
A developer is inserting, updating, and deleting multiple lists of records in a single transaction and wants to ensure that any error prevents all execution. How should the developer implement error exception handling in their code to handle this?
Options
- AUse Database.setSavepoint() and Database.rollBack() with a Try/Catch statement
- BUse a Try/Catch and use sObject.addError() on any failures
- CUse Database methods to obtain lists of Database.SaveResults
- DUse a Try/Catch statement and handle DML cleanup in the catch statement
How the community answered
(21 responses)- A76% (16)
- B5% (1)
- C14% (3)
- D5% (1)
Community Discussion
No community discussion yet for this question.