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

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 failure due to the Task insert statement, so that manual restarts are not needed?
A . Deactivate the trigger before the integration runs.
B . Remove the Apex class from the integration user’s profile,
C . Use a try-catch block after the insert statement,
D . Use the Database method with allOrNone set to false.

Answer: D

Explanation:

Using Database.insert with allOrNone=false allows partial success in DML operations.

Option D: Use the Database method with allOrNone set to false.

Records that cause errors are not inserted.

Successful records are committed.

Prevents the entire batch from failing.

Why Not Other Options:

Option A: Deactivating the trigger is not practical.

Option B: Removing the class from the profile may cause other issues.

Option C: A try-catch block won’t prevent the batch from failing.

Reference: Database Methods:

"Use the Database DML methods to specify whether or not to allow partial record processing."

― Apex Developer Guide: Using the Database Class

Latest DEX-450 Dumps Valid Version with 456 Q&As

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

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments