Skip to main content
I have seen people state online that to call an object relationship "many-to-many," the relationship fields on the child object can be either master-detail or lookup. However, Salesforce article "Create a Many-to-Many Relationship" doesn't say anything about lookup fields and it's pretty clear that in order for it to be a M2M relationship, the fields must be M-D. The same is true for instructions in the Force.com Fundamentals book (also official Salesforce documentation).

 

I've been trying to understand why that is, and the best explanation I found was in the second answer to this post: http://salesforce.stackexchange.com/questions/114617/junction-object-in-salesforce.

 

So, at this point my understanding is that in order for a relationship to be called M2M, the relationship fields on the child object must be M-D because "many-to-many" by definition guarantees that there are two parents. With lookup fields, this is not guaranteed. Even if we make those lookup fields required, there is still room for meddling and thus breaking the two-parent structure (e.g, 1. we could forget to make the lookup fields required; 2. someone could remove the requirement; 3. unless we explicitly select "Don't allow deletion of the lookup record that's part of a lookup relationship," there is nothing to prevent the deletion of one or both parents, etc.) However, with M-D fields the presence of two parents is guaranteed by design (parent is always required, cannot be edited after the child record is saved, etc.)

 

Is this explanation correct? Are there any reliable resources to support it (e.g., Salesforce documentation, books on database systems, etc.)?

 

Thank you in advance!

 

 
5 answers
  1. Apr 3, 2017, 3:58 PM
    I am assuming they push for the M-D relationship because it makes it easier to do Rollup Summaries. Also, some of the docs are old, so there might have been different terms at the time or there wasn't the same functionality. 

     

    I think with the M-D there are also some reports that are made for you as you turn it on, so maybe they encourage it because of that. 
0/9000