Salesforce Platform Developer I (legacy) — Question 132

A developer created a new after insert trigger on the Lead object that creates Task records for each Lead.

After deploying to production, an existing outside integration that inserts Lead records in batches to Salesforce is occasionally reporting total batch failures being caused by the Task insert statement. This causes the integration process in the outside system to stop, requiring a manual restart.

Which change should the developer make to allow the integration to continue when some records in a batch cause failures due to the Task insert statement, so that manual restarts are not needed?

Answer options

Correct answer: C

Explanation

The correct answer is C because using the Database method with allOrNone set to false allows for partial success in the batch operation, meaning that even if some Task inserts fail, the integration can still proceed with the remaining records. Options A and D do not address the root cause of the issue and would disrupt the intended functionality. Option B, while useful for handling exceptions, would not prevent the entire batch from failing, which is the primary concern.