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
mahimahi 

error while delete ::::::self_reference_from_trigger.

Code:
trigger deleteTempAcc on Account (after update) {

account acc=trigger.new[0];

account acctodelete=[select Oracle_Company_ID__c from account where id=:acc.id ];

if(acctodelete.Oracle_Company_ID__c==0)
delete acctodelete;

}

 
hi all,
 
i need to delete account when some field in it got updated.
 
in following example when oracle_company_id get updated, account should be deleted.
 
but i am getting error:: self_reference_from_trigger.
 
please help me out.
kpetersonkpeterson
A record can't delete itself in it's own trigger.  If the field the deletion is relying on is being updated by a person then the person should just udpate the field and delete the account themselves.  If the field is being updated by another trigger then maybe have that trigger delete the account?