Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
Salesforce Administrator
medium

Can you build a Roll-Up Summary on a Lookup relationship? If not, what are the alternatives?

Roll-Up Summary fields are only available on Master-Detail relationships. Salesforce limits them to master-detail because rollups depend on the parent owning sharing and lifecycle of the child — semantics that lookup doesn't guarantee.

If you have a lookup and need a rollup, you have several options:

  1. Convert lookup to master-detail. Possible only if every child record has a non-null parent (otherwise the conversion fails). You also accept the master-detail constraints — child loses owner, sharing inherits, cascade delete.
  2. Declarative Lookup Rollup Summaries (DLRS) — an open-source unmanaged package that builds rollups on lookup relationships using scheduled jobs and triggers under the hood. Reliable for most use cases, well-known, but adds a dependency.
  3. Apex trigger — write a trigger that recalculates the parent's summary field when child records change. Most flexible, but it's code; needs tests and bulk safety. Don't write a trigger in a loop with SOQL inside.
  4. Record-Triggered Flow on the child object — recalculate the parent's summary in a Flow when child records change. Easier to maintain than Apex but be cautious with scale (governor limits, recursion).
  5. Reports — sometimes the rollup is only needed for reporting. A report grouped by parent can do the math without storing it on the record. Skip the rollup entirely.

In practice: convert to master-detail if the schema supports it; otherwise use DLRS or Flow for declarative orgs and Apex for code-friendly orgs.

Why this answer works

Tests schema-design judgement. Newer admins often try and fail to add a rollup to a lookup, then reach for the wrong workaround. Mentioning DLRS by name is a strong signal — it's the de facto declarative solution most senior admins know.

Follow-ups to expect

Related dictionary terms