Salesforce
PDII · Question #192
PDII Question #192: Real Exam Question with Answer & Explanation
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
Community Discussion
No community discussion yet for this question.