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
cutspmjerrycutspmjerry 

unexpected exception - maximum trigger depth exceeded

I am going through some examples in the Developer guide and can't get passed an error.  The code is a trigger that adds a record in another table based on the value of a field that has been changed.  I really don't see how I am exceeding the trigger depth when I am simply inserting a record into a seperate table. 

 

Also, the exceptions are not being caught.  The error message I receive does not come from my code.

 

Any help would be appreciated!

 

 

 

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger assignInterviewers caused an unexpected exception, contact your administrator: assignInterviewers: maximum trigger depth exceeded Job_Application trigger event AfterUpdate for a02A00000018Q5D Job_Application trigger event

 

trigger assignInterviewers on Job_Application__c (after insert, after update) {

   List<Review__c> addReviews = new List<Review__c>();

    for (Job_Application__c JA : trigger.new){

      List<User> selectedReviewers = [select ID from user limit 1];

        if (JA.status__c == 'New') {

         ID jobID = JA.ID;

         For ( User u : selectedReviewers) {            addReviews.add(new Review__c( Job_Application__c = jobID, reviewer__c = u.ID, rating__c = 3));

         }

           try {

              insert addReviews;

         }

           catch (DmlException de) {               for (Integer i = 0; I < de.getNumDml(); i++) {

              JA.addError('dmlexption' + de.getDmlMessage(i));

           }

       }

         finally {          JA.addError('made it to finally');

       }

    }

  }

}

srisomsrisom
Do you have a trigger on Review__c that does anything to Job_Application__C ?