SALESFORCE-PD1 Process Automation And Logic Practice Question
A developer creates an Apex trigger that updates related Contact records whenever an Account record is updated. The trigger performs a DML operation on the Contacts. During testing, updating an Account causes the trigger to fire infinitely and throw a System.LimitException: Maximum trigger depth exceeded. Which design pattern should the developer implement to prevent this recursion?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use a static boolean flag in a helper class to ensure the trigger block executes only once per transaction.
Using a static boolean flag in a helper class is the standard Salesforce pattern to prevent recursive trigger execution by tracking whether the trigger logic has already run in the current transaction.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use a Database.setSavepoint() before the DML operation to rollback if recursion occurs.
Why it's wrong here
Incorrect. Savepoints roll back data changes but do not prevent the trigger from firing repeatedly until limits are reached.
- ✗
Convert the trigger logic into a Queueable Apex job to defer execution to a separate transaction.
Why it's wrong here
Incorrect. While this avoids recursive depth limits by moving work out of the transaction, it introduces asynchronous processing overhead and does not stop the synchronous recursion entirely.
- ✓
Use a static boolean flag in a helper class to ensure the trigger block executes only once per transaction.
Why this is correct
Correct. A static variable retains its value for the duration of the request, allowing the code to check if it has already executed.
- ✗
Check Trigger.isExecuting to determine if the trigger is running in a recursive context.
Why it's wrong here
Incorrect. Trigger.isExecuting always returns true within any trigger execution context.
About these practice questions
This SALESFORCE-PD1 question is part of Courseiva's 493-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed August 2026 · checked against the official Salesforce exam blueprint
This SALESFORCE-PD1 practice question is part of Courseiva's free Salesforce certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SALESFORCE-PD1 exam.