PDI · Question #217
PDI Question #217: Real Exam Question with Answer & Explanation
The correct answer is B: The trigger is getting executed multiple times.. The 'Maximum trigger depth exceeded' error typically indicates that a trigger is recursively calling itself or other triggers, leading to an excessive number of executions within a single transaction.
Question
A developer created a trigger on the Account object. While testing the trigger, the developer sees the error message 'Maximum trigger depth exceeded'. What could be the possible causes?
Options
- AThe developer does not have the correct user permission.
- BThe trigger is getting executed multiple times.
- CThe trigger is a a helper class.
- DThe trigger does not have sufficient code coverage.
Explanation
The 'Maximum trigger depth exceeded' error typically indicates that a trigger is recursively calling itself or other triggers, leading to an excessive number of executions within a single transaction.
Common mistakes.
- A. User permissions control what data a user can access or actions they can perform, but they do not directly cause a 'Maximum trigger depth exceeded' error related to trigger recursion.
- C. Whether a trigger uses a helper class or not is a code organization pattern; it does not inherently cause a 'Maximum trigger depth exceeded' error, although a helper class could contain logic that leads to recursion.
- D. Insufficient code coverage is a metric for test quality and deployment readiness, not an error that occurs during trigger execution itself; it would prevent deployment but not cause a runtime execution error like trigger depth.
Concept tested. Trigger recursion and governor limits
Reference. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_recursion.htm
Topics
Community Discussion
No community discussion yet for this question.