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:::maximum trigger depth exceeded

hi All,
 
i am getting 'maximum trigger depth exceeded' error while inserting new account through trigger.
 
i am using developer account.
 
cud anybody help me out?
 
thanks,
Mahi
gokubigokubi
Post your trigger code...
mahimahi
hi
this is trigger code::
 
trigger test_createacc on Account (before insert) {
//account[] a=trigger.new;
 //myCreateAcc.mycreateacc();
account aa= new account(name='xxx', sla__c='gold', SLAExpirationDate__c=system.today(),Active__c='yes',SLASerialNumber__c='11');
insert aa;
}
gokubigokubi
Your Account trigger is creating a new Account, which is firing the Account trigger again. You're essentially in an infinite loop, and Apex kicks you out. I'm not sure what you're trying to do with your code, but if you have a trigger that is modifying the same object that you're triggering on, you have to be careful not to get into these kinds of loops.
mahimahi
thanks a lot :)
 
actually i m new to apex..so playing with it.