7

I'm struggling to find a particular use case where Roll up summaries wouldn't work for lookups.. Please share if there is a valid reason why they're only available for master-detail relationships.

5

Roll-Up Summary even though looks like a config for us, its very very CPU and resource intensive for Salesforce. Whenever a child record changes SF has to update the parent after running big sum of complex calculations.

In Database terminology, Lookups are just Foreign Keys to refer the primary key of the other table. That's it, no extra feature. Most of the times we just wanna refer other tables, here Lookup suits that very well why add extra complexity to support rollups when you have master-detail exactly for it.

Master - Details are Super - Lookups with extra features like rollups, sharing etc. This comes at an extra cost. Master - Details are proved to be the main culprit for the record - locking. Hence there is a strict limit on the Number of Master Details you can have whereas on Lookups limits are bit relaxed.

I have seen few projects where the Master-details use case would suit but still, they build it using lookups as the Master-Detail performance overhead / Record Locking would just be too hard to handle. Lookup gives you the power to extend that using Apex.

In Computer Science, we use this concept, open for extension closed for modification.

Lookups are basic building structure, that provides the feature of Foreign Key

Master Details are Extension of Lookups that provide us the feature of Foreign key from lookup and so much more

| improve this answer | |
  • Thanks for your input. Although your point about complexity maybe an important factor, your answer is mainly concerned with the differences between lookups and master-details. Closer, but not quite what I'm looking for. – Adnan Haideri Feb 11 '19 at 9:16
4

Please share if there is a valid reason why they're only available for master-detail relationships.

It's by design, and how/why Salesforce decided to do it that way is abstracted.

If you are looking for roll up summary on lookup, then Declarative Rollup Summary Tool by Andrew Fawcett is what you need.

| improve this answer | |
  • Thanks for your input, but it hasn't answered my question. I'm more interested in the 'why?' than the 'how?' Nice workaround though :) – Adnan Haideri Feb 8 '19 at 6:23
  • 1
    A why here can be only answered by Salesforce. That is by design. And why Salesforce designed it that way is not available in any public documentation as far as I know of. There could be many such why questions as why did Salesforce do a particular thing in a specific way, and any such question cannot be answered if not documented. – Jayant Das Feb 8 '19 at 13:50
  • Right. That is precisely my question.. – Adnan Haideri Feb 9 '19 at 5:32

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.