Salesforce: Junction Object as Parent Object

In Salesforce, a junction object cannot be the parent in a master-detail relationship.

 

Use case: A company that sells water heater will install their product for different owners in different locations. We will use the Account object to represent the Owner. Location object is like a city/state. One Account can have multiple Location and One Location can have multiple Owners. To achieve the many-to-many relationship, we create Account Location as the junction object. If you create another object called “Installation” and park this object as a child under Account Location using Master-Details relationship, Salesforce will not allow this. Below is the behaviour you will encounter:

 

Behavior #1:

 

  1. Account object is already exist in Salesforce.
  2. Create a new custom object named Location.
  3. Create a new custom object named Account Location (this will be the junction object).
  4. Create 2 master-detail relationship on Account Location object link to Account and Location.
  5. Create a new custom object named Installation.
  6. Create a master-detail relationship on Installation link to Account Location. The Account Location object will not be listed as an option.

 

Behavior #2:

  1. Create a new custom object named Installation.
  2. Create a new custom object named Account Location.
  3. Create a master-detail relationship (Account Location) in Installation object.
  4. Account object is already exist in Salesforce.
  5. Create a new custom object named Location.
  6. Create 2 master-detail relationship on Account Location object link to Account and Location. When you trying to create the second master-detail relationship in Account Location, you will see the following:

 

To overcome this, you can use normal Lookup relationship between Account Location and Installation object.

Get in touch today to see how WDCi can help your business.