Skip to main content
New tool CRON Expression Builder — preview next run times before you schedule Apex. Open the builder →
Salesforce Flow diagram illustrating how to fix roll-up summary field update failures across objects
Admin

Fix your roll-up summary formula field cross-object issues

Ever wondered why your roll-up summary doesn't update when a grandparent record changes? Cross-object formulas do not trigger the parent recalculation. Here is how to work around that limitation with Flow.

The short answer

Salesforce roll-up summary fields do not recalculate on their own when the aggregated child formula field pulls its value from a related record through a cross-object reference. Work around it by forcing a DML update on the child records with Flow or Apex, by scheduling periodic recalculations, or by using DLRS.

Key takeaways Build a record-triggered Flow or Apex trigger that runs a dummy DML update on the child records whenever the referenced lookup record changes. Bulkify the Flow when you touch many child records at once, or you will hit governor limits such as System.LimitException. Use Declarative Lookup Rollup Summaries (DLRS) to roll up data across lookup relationships, which native roll-up summary fields do not handle. Run a scheduled Flow for recalculations that do not have to be accurate to the second, which is easier on system resources. Reach for an Apex trigger instead of a Flow when you are processing large batches and need maximum control and performance.

Roll-up summary fields and cross-object formulas

Ever tried to build a roll-up summary formula field that points to a child record, only to realize that child record is pulling its value from a third object? It is a classic Salesforce "gotcha" that I have seen trip up even senior devs. You set everything up, the formula looks perfect, but then you change the grandparent record and... nothing. The roll-up doesn't budge.

It won't work automatically if your child formula uses a cross-object reference. Salesforce is very specific about what triggers a recalculation. If the child record itself doesn't undergo a DML update (a save operation), the parent has no idea that the value sitting in that child formula has changed.

Why your roll-up summary formula field stays stuck

The technical reason is that roll-up summary fields are event-driven. They only wake up and do work when a child record is created, updated, or deleted. Change a field on a "grandparent" or some other lookup record and the formula on the child updates visually in the UI, but the child record never gets saved.

With no save happening on the child, the parent never gets the memo to recalculate. I have seen teams waste hours refreshing pages and clearing caches while the data sits there unsynced, because the DML event never fired. It works in your head and fails in the database.

A realistic screenshot of a Salesforce Flow Builder canvas showing an automation path designed to sync data between related objects.

Reliable ways to use a roll-up summary formula field

If you need the roll-up to reflect changes from another object, you have to force Salesforce to see that change. The most common way I have done it is the "touch" method.

Build a record-triggered Flow on the object that the child formula references. When that record changes, the Flow finds the related child records and performs a "dummy update" on them, which can be as simple as flipping a hidden checkbox. That tiny update is enough to make the parent recalculate its roll-up.

Pro tip: When you are "touching" hundreds of child records via Flow, make sure you understand Salesforce Flow bulkification. If you don't, you'll hit governor limits faster than you can say "System.LimitException".

Choosing between Flow, Apex, or DLRS

Code or declarative? It usually comes down to the complexity of your data model. For a simple relationship, a Flow is fine. With massive data volume or complex logic, Apex vs Flow goes into which one handles the load better.

  • DLRS (Declarative Lookup Rollup Summaries) is the community favorite. It handles lookup roll-ups, which native Salesforce doesn't, and runs on a schedule or in real time.
  • Scheduled Flows: if you don't need the number accurate to the second, recalculate the totals every night. Much easier on your system resources.
  • Apex triggers are the heavy hitter. Absolute control and the highest performance on large batches.

// Simple snippet to 'touch' child records
List<Child_Object__c> childrenToUpdate = [SELECT Id FROM Child_Object__c WHERE Parent_Lookup__c IN :ids];
for(Child_Object__c c : childrenToUpdate) {
    c.Force_Recalc_Check__c = !c.Force_Recalc_Check__c; 
}
update childrenToUpdate;

Key takeaways for your roll-up summary formula field

  • A roll-up summary formula field only works automatically if the formula stays on the child record itself.
  • Cross-object formulas in a roll-up will not trigger updates when the distant record changes.
  • Use a "touch" mechanism (Flow or Trigger) to force a child record save if you need real-time updates.
  • Consider DLRS if you need to roll up values over a lookup relationship instead of a Master-Detail.
  • Always test with bulk data to make sure you aren't hitting limits.

Final thoughts on implementation

Roll-up summary fields do a lot, and the cross-object formula is where they stop. Don't fight the platform logic. If the native roll-up isn't cutting it, move to a Flow or a scheduled job. Being honest about these limitations early in a project has saved me a lot of headache during UAT. Pick the simplest tool that gets the job done without breaking your governor limits.

Frequently asked questions

Why is my roll-up summary field not recalculating when a cross-object formula changes?

Roll-up summary fields are event-driven. They only recalculate when the child record goes through a create, update, or delete DML event. Changing a referenced grandparent or lookup record updates the child formula visually in the UI without saving the child record, so nothing tells the parent to recalculate.

How do you force a roll-up summary field to update on cross-object changes?

Use the touch method. Put a record-triggered Flow or an Apex trigger on the referenced object and have it run a dummy DML update on the related child records. Saving the child record fires the DML event the parent roll-up field needs before it will recalculate.

When should you use DLRS instead of native Salesforce roll-up summary fields?

Use Declarative Lookup Rollup Summaries (DLRS) when your data model uses lookup relationships instead of Master-Detail. DLRS also runs roll-ups in real time or on a schedule, whichever suits the requirement.

When should you use Apex triggers instead of Flow for roll-up recalculations?

Reach for an Apex trigger when you have massive data volumes or complex logic and you need maximum control and performance on large batches.

Newsletter

One email every Tuesday

New guides, tool updates, and the release-note changes that break things.

No spam. Unsubscribe in one click.

Comments

Loading comments...

Leave a Comment