Loading

Why the 'SELF_REFERENCE_FROM_TRIGGER' error occurs from Apex triggers

Julkaisupäivä: Jun 24, 2026
Kuvaus

The SELF_REFERENCE_FROM_TRIGGER error in Salesforce Apex indicates that a Data Manipulation Language (DML) operation has attempted to update or delete a record that is already being processed by an active trigger. This creates a circular reference that Salesforce prevents to maintain data integrity. This error is common in orgs with complex trigger architectures involving multiple objects with interdependent automation.

Ratkaisu

Summary

The SELF_REFERENCE_FROM_TRIGGER error occurs when an Apex DML operation conflicts with an already-in-progress DML event on the same record. This article covers two common patterns that cause this error.

Direct DML Operations That Cause SELF_REFERENCE_FROM_TRIGGER

A direct operation occurs when:

  1. A trigger performs a DML operation that attempts to update a record that is already being updated by another trigger. For more information, see DML Operations in Apex.
  2. An Apex trigger causes a DML event to run on a record already involved in an identical DML event.

Indirect Operations That Cause SELF_REFERENCE_FROM_TRIGGER

An indirect operation occurs when a chain of automation creates a conflicting update. For example:

  1. A request is submitted to update Object A.
  2. A before-update trigger on Object A creates an Object B.
  3. Object A is updated.
  4. An after-insert trigger on Object B queries Object A and updates it.

In this scenario, Object A is being updated indirectly via the trigger chain. This generates the SELF_REFERENCE_FROM_TRIGGER error because Object A is already mid-transaction.

Knowledge-artikkelin numero

000385060

 
Ladataan
Salesforce Help | Article