Salesforce
PDII · Question #411
Business rules require a Contact to always be created when a new Account is created. What can be used when developing a custom screen to ensure an Account is not created if the creation of the…
The correct answer is D. Use setSavePoint() and rollback() with a try/catch block. See the full explanation below for the reasoning.
Question
Business rules require a Contact to always be created when a new Account is created. What can be used when developing a custom screen to ensure an Account is not created if the creation of the Contact fails?
Options
- AUse the Database.Delete method if the Contact insertion fails.
- BUse the Database.Insert method with allOrNone set to False.
- CDisable Validation rules on Contacts and set default values with a Trigger.
- DUse setSavePoint() and rollback() with a try/catch block.
How the community answered
(35 responses)- A6% (2)
- B14% (5)
- C3% (1)
- D77% (27)
Community Discussion
No community discussion yet for this question.