A developer created a new trigger that inserts a Task when a new Lead is created. After deploying to production, an outside integration chat reads task records is periodically reporting errors.
Which change should the developer make to ensure the integration is not affected with minimal impact to business logic?
A. Deactivate the trigger before the integration runs.
B. Use a try-catch block after the insert statement.
C. Remove the Apex class from the integration user's profile.
D. Use the Database method with all or None set to false
D. Use the Database method with all or None set to false
Explanation:
When inserting records in Apex, using Database.insert(records, false) with allOrNone=false allows partial success:
Successful records are committed,
Failed records are skipped,
No unhandled exceptions are thrown.
This prevents the entire transaction from failing, which helps ensure that external integrations (like the one reading Task records) aren’t disrupted by rare insert failures in the trigger.