function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jdogsailingjdogsailing 

Making Many-Many Relationships Work in UI

I have two custom objects (Survey and Question) that are m-n linked via junction objects (SurveyQuestion has a lookup relationship to each). I can use these junction objects just fine in my Apex code but I'd like to define some report types that can operate across the relationship. Is this possible?

 

From the developer resources (http://wiki.apexdevnet.com/index.php/An_Introduction_to_Force_Database) it says I should be using master-detail relationships but gives no further instructions. In another online document (many to many relationships.doc) it says to use lookup relationships as I have done. That document also suggests that the tabs for the related objects can be customized to traverse the junction object automatically but that document is for an earlier UI version and it no longer applies.

 

Are there any current documents that describe how to make these relationships really work in the UI?

Jeff

Best Answer chosen by Admin (Salesforce Developers) 
shillyershillyer

Hi Jeff,

 

If you want true many-to-many that includes referential integrity (meaning if the parent is deleted, the cascading children are too), then you should be using Master-Detail.

 

SurveyQuestion should have two Master-Detail fields, one to Survey and one to Question. SurveyQuestion will inherit the tab color of the first parent field created. More can be found here.

 

Hope that helps,

Sati

All Answers

shillyershillyer

Hi Jeff,

 

If you want true many-to-many that includes referential integrity (meaning if the parent is deleted, the cascading children are too), then you should be using Master-Detail.

 

SurveyQuestion should have two Master-Detail fields, one to Survey and one to Question. SurveyQuestion will inherit the tab color of the first parent field created. More can be found here.

 

Hope that helps,

Sati

This was selected as the best answer
jdogsailingjdogsailing

Thanks for the reference, that surely clears things up.

Jeff