Junction object primary master effects
Key Takeaway
The first master-detail relationship you create on a junction object becomes the primary one, and it controls the junction record's look, inherited owner and inherited division.
A junction object is a custom object with two master-detail relationships. You use it to model a many-to-many relationship, which lets each record of one object link to many records of another object, and the reverse. For example, a Bug can relate to many Cases, and a Case can relate to many Bugs. One master is primary and the other is secondary, and that difference affects pages, ownership, divisions and reports.
How to create a junction object
Creating a many-to-many relationship requires the "Customize Application" permission.
- Create the custom object that will be your junction object. Salesforce recommends a label that shows its purpose, such as BugCaseAssociation, and the auto-number data type for the Record Name field.
- Don't launch the custom tab wizard before you click Save, because junction objects don't need a tab.
- On the junction object, create the master-detail relationship to the object you want as primary before you create the other one. Creation order decides which master is primary, so this first relationship becomes the primary relationship. Its object is the primary master object.
- Create the master-detail relationship to the other object. This second relationship becomes the secondary relationship, and its object is the secondary master object.
A custom object can have up to 2 master-detail relationships, so a junction object has no room for a third master-detail relationship. Each relationship also counts toward the object's maximum number of custom fields.