What should the developer do to ensure the parent always has a child record?

A business requires that every parent record must have a child record. A developer writes an Apex method with two DML statements to insert a parent record and a child record.

A validation rule blocks child records from being created. The method uses a try/catch block to handle the DML exception.

What should the developer do to ensure the parent always has a child record?
A . Use Database.insert () and set the allorNone parameter to true.
B. Use addError () on the parent record if an error occurs on the child record.
C. Set a database savepoint to rollback if there are errors.
D. Delete the parent record in the catch statement when an error occurs on the child record DML operation.

Answer: C

Latest PDII Dumps Valid Version with 280 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments