+ Start a Discussion

error while delete ::::::self_reference_from_trigger.

trigger deleteTempAcc on Account (after update) {

account acc=trigger.new[0];

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

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.
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?