ApexAdvancedtriggersrecursionbulkification
Prevent trigger recursion when rollup updates cascade across five related objects
Real World Scenario
Opportunity line item trigger updates Opportunity, which updates Account rollup, which fires Account trigger updating child Contacts, causing MAXIMUM_TRIGGER_DEPTH exceeded during bulk order import.
Expected Answer
• Map cross-object trigger chain in architecture diagram before coding
• Static recursion guard keyed by object + operation not global boolean
• Consolidate rollups into single after-trigger pass per object
• Use Platform Event for downstream enrichment instead of synchronous cascade
• Integration bypass via hierarchy custom setting for known bulk paths
• Test recursion with 200-record bulk insert simulating production order volume
• Consider declarative roll-up summary or DLRS for simple sums reducing trigger coupling
Follow-Up Questions & Answers
Click to expand — each follow-up includes a direct, interview-ready answer
Direct answer: Map cross-object trigger chain in architecture diagram before coding Also consider: Static recursion guard keyed by object + operation not global boolean In practice: Consolidate rollups into single after-trigger pass per object Optimize for scale and operational observability.
Architect Perspective
Five-object synchronous chains fail at scale—architect async boundaries at object two or three.