1

I have an object that has a custom field and a roll up summary field. When the value of the roll up summary field changes, or the value of the custom field changes, I want to update a field.

Am I right to thing that workflow rules won't work here, because they are not triggered by a change in the rollup summary field?

Thanks

1

See Triggers and Order of Execution for details, but in summation, workflow rules, assignment rules, etc are skipped in recursive updates. This means that workflow rules on parent and grandparent records won't trigger, but before and after triggers on parents and grandparents will, which means you should place your logic within code if you want it to always be evaluated.

  • So, I should create a trigger, I guess an after update trigger? Or is it a before update trigger? Tks – Lily Jan 9 '15 at 19:28
  • Before Update if you're trying to modify the parent record, or After Update if you're trying to update some other related information. – sfdcfox Jan 9 '15 at 19:37
  • Step 16 in Triggers and Order of Execution: If the record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the parent record. Parent record goes through save procedure. and During a recursive save, Salesforce skips steps 8 (assignment rules) through 17 (roll-up summary field in the grandparent record). - this seems contradictory to your answer – cropredy Feb 24 '18 at 0:04
  • if the save is on the child, is the RSF update on parent considered recursive? – cropredy Feb 24 '18 at 0:11
  • @cropredy I can see where the confusion comes from. I think I actually need to try it out. I probably thought the note applies to the parent being a recursive update, but given my more experienced self, I'm second-guessing this answer. I'll model something up and try it out. – sfdcfox Feb 24 '18 at 0:37
4

Note the following

If you have a master record Foo__c with a detail record FooChild__c and a RSF within Foo__c that, say, counts the number of FooChild__c (FooChildCount__c), then

  • With a workflow on Foo__c defined to run every time Foo__c is created or edited where FooChildCount__c > 0
  • Will execute the workflow each time a FooChild__c is added as this causes the RSF field to be changed and hence the workflow will execute

The RSF need not be a Count operation; if it is a sum or avg/min/max and the rsf field changes because of a DML operation on FooChild that alters a value used in the RSF calc, the workflow on the parent Foo__c will fire provided its condition is met.

So, while workflows won't fire on recursive updates as per Triggers and Order of Execution, it is not clear from OP whether recursive updates are in fact the transaction in question.

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.