I want to build an update trigger on a rollup summary field.

Say I have a parent record A, A have 1000 children records linked with a Master-Detail relationship.

1.First Operation: delete 1000 records, if the code is like

List<Child__c> children = [select id from Child__c where parentid = A.Id];
delete children;

How many times would the update trigger on parent record A run?

Is it 5? What if the second 200 batch is being deleted when the first update trigger is running? I'm confused with the execution order and the events start&end order.

2.Second Operation: insert 1000 child records from data loader or any external app.

How many times would the update trigger on parent record A run? Is it 5? Is it similar to the delete operation?



The Roll up summary field is a "SUM" of it's children records field num__c which has a number type.

The question assumes the num__c field of the deleted&inserted children records have value on this field.

The question also specified 1000 child records belongs to a same parent record

  • Can you edit your question to specify the content of your Rollup Summary field? Are you performing a COUNT operation? SUM?
    – Adrian Larson
    Feb 27, 2016 at 23:50

1 Answer 1


The update triggers on parent will be fire .200 child records are processed at a time when you delete 1000 records .This means there will be 5 chunks .Lets say 200 child belongs to 10 parent records ,trigger.new will have 10 parent records .

The trigger on Parent would run for update case .In your case you are deleting or inserting and that should trigger update triggers on parent records .

To confirm this behavior just did a quick experiment

1.Create a parent object and a child object .Associate them via master detail .

2.Create a number field on the child record .

3.Create a roll up summary field on the parent record summing the number field that's created in previous field

4.Create a trigger on the parent record like below

trigger triggerSpeaker on Parent__c (before update) {
  if(trigger.isbefore && trigger.isupdate){
    for(Parent__c sp:trigger.old ){
      sp.addError('You cannot update me');

5.Delete or insert the data into child objects via data loader or developer console.You should see the add error indicating triggers fire

  • I see a negative vote .Could you please elaborate the reason why this answer is negatively voted ? Feb 27, 2016 at 21:33
  • Hi just see your answer. Let's say the roll up summary is a sum of its children's field num__c and the question's assumption is the deleted&inserted children records have value on field num__c
    – sfdcnoob
    Feb 27, 2016 at 23:01
  • Still the answer holds correct .please try in dev org before concluding it's wrong .triggers won't fire at all. Feb 27, 2016 at 23:09
  • Ok I didn't down vote the answer
    – sfdcnoob
    Feb 27, 2016 at 23:11
  • @sfdcnoob cool.please verify the response .sorry about me assuming you down voted this . Feb 27, 2016 at 23:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.