function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Custom Sync Trigger throws self reference error

Hello everyone,

I have a custom trigger in my Org to do some data changes before insert. Therefore I implemented some code even evaluating if it was triggered isBefore and then doing some update:

        for (Integer i =0; i < oppLineItems.size(); i++) {
            invoiceLineItems[i].opp_ref__c = oppLineItems[i].Id;

But still I get an error: SELF_REFERENCE_FROM_TRIGGER.
Any suggestions or ideas?

The thing is, it was working just fine for half a year but now (in relation to the last release ?!?) it is not working since about two weeks?

It would be awesome to get some hints on this one!
SwethaSwetha (Salesforce Developers) 
HI KerstinV,
SELF_REFERENCE_FROM_TRIGGER error from Apex indicates that you have attempted to update or delete a record that is already being updated by another trigger.

There could be direct /indirect operations that cause Apex error as mentioned in

I know this is an old post to conclude if this is release-related or not but if you are still facing this issue, can you provide more details like what the logs show so I can suggest. 


If this information helps, please mark the answer as best. Thank you