Development questions

What is a Recursive Trigger and how does it cause the Maximum trigger depth exceeded (limit: 16) error?

DevelopmentMediumAccentureWiproEY

A recursive trigger is one whose logic performs DML that causes the same trigger (or another trigger that updates back) to fire again, repeatedly.

Example: an after update trigger on Account updates Accounts, which fires the after update trigger again, and so on. Salesforce allows trigger nesting only up to depth 16; beyond that it throws Maximum trigger depth exceeded and rolls back the transaction.

Prevent it with a static Set of processed Ids, by checking that field values actually changed, or by moving same-record changes into before triggers.

apex-triggertriggerrecursion