Platform
Maximum trigger depth exceeded: stop recursive saves
Trace recursive Salesforce updates, compare field transitions and prevent repeated side effects without skipping legitimate bulk work.
An Account updates a Contact, and the Contact updates the Account again. The save cycle continues until the platform stops it.
The governor reference defines a trigger recursion-depth limit. Raising a limit isn’t the useful repair: identify the cycle and stop issuing an update when the required state is already true.
Draw the update cycle
List each automation that writes a record and the field change that activates the next step. Include flows, triggers, roll-up recalculations and managed logic visible in the log. The order of execution explains why a related write can enter another save procedure.
For each edge in that cycle, ask whether the second update changes a business value. If the desired value already matches, skip the write. For a transition-driven action, compare the old and new values of the fields that matter.
A status change should not send the same external notification every time an unrelated field is edited. Give consequential side effects their own operation identity or recorded completion state where appropriate.
Avoid a transaction-wide “already ran” shortcut
A single static Boolean can suppress later legitimate work in the same transaction. Bulk inputs and partial-success retries make that behavior particularly hard to reason about.
A set of processed record IDs can be more precise, but it still needs a definition of what “processed” means. A record may undergo another legitimate transition. Key a guard to the operation or transition when necessary, and make the underlying action idempotent rather than depending only on a guard.
Where the task only changes fields on the triggering record, consider a before-save mechanism. That can avoid an extra update, but it doesn’t replace a review of the full automation path.
Reproduce more than one pass
A useful regression test performs the initial transition, an unrelated update and a repeated request. Assert that the intended fields change and that the consequential action occurs only when it should.
Add a bulk test with multiple records and different transitions. If a guard causes the first record to work and later records to be skipped, a single-record test won’t reveal it.
Also test failure and retry when the operation supports partial success. Salesforce documents that static variables are not reset between certain retry invocations within the same transaction. The guard must not mistake a previous attempt for confirmed completion.
Fix the cycle at its business condition. A recursion counter that merely stops after several passes can leave the final record state dependent on which automation ran first.