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
sgkmillssgkmills 

A Trigger fired from another Trigger

Hi,

 

I have 2 custom objects, once is called 'res' and the other called 'res_mt', which has a lookup relationship to 'res'.  I have a trigger on the 'res' object that creates 48 'res_mt' records upon 'afterinsert'.  This trigger works fine.

 

I then added a new object called 'res_d', which has a lookup relationship to 'res_mt'.  I created a trigger on the 'res_mt' object that would create 31 'res_d' records upon 'afterinsert'.

 

I try to add a 'res' record and get a Too Many DML Rows error.  When looking in the 'System Log', I see the trigger on 'res' gets fired and the 48 records are created.  But, the 2nd trigger that creates the 31 'res_d' records, doesn't get fired for each of the 48 records!  I thought that for each of the 48 'res_mt' records, I would see the 2nd trigger fire in between, like a nested trigger.  That doesn't seem to be the case, it seems that the first trigger must complete before the 2nd starts.  

 

Does anyone have any suggestions for me?

 

 

When looking at the System Log, I see that 

Pat McQueenPat McQueen

Your description seemed to be cut off.  Maybe if you posted the specific error it would help.

 

pat