I am configuring a many-to-many relationship between custom object and Contact. For this purpose I created a junction object. Next, I have to create 2 Master-Detail relations. One for custom object, another for Contact. When creating a Master-Detail relationship field, my custom object is not visible among other objects. What could cause this problem?

  • 1
    since you have already added an answer, I just want to comment here. For others, there could be another reason also. Official documentation says You can have up to three custom detail levels i.e.., if childObj1 is already a great-grand child of another masterObj1, you could not be able set this childObj1 as master to another object. help.salesforce.com/…
    – sam_s
    Commented Feb 1, 2016 at 15:53

3 Answers 3


There are a few rules that may help you. A custom object cannot be the master to a standard object. Master detail relationships can only be created where there are not existing records in the object on the detail side of the relationship. If this does not help you, it would help to have more information on what objects are masters and which objects are being used for detail. Thanks


I found the answer. Only two Master-Detail relationships are allowed per custom object. My custom object already had 2 Master-Detail relationships. I converted one field to lookup. After that, I was able to see this object among other objects when creating a Master-Detail relationship on junction object.

  • Is there any documentation for the above from salesforce ? Commented Sep 7, 2017 at 7:14

The Exception is self explanatory here and you have to remember the rules while creating the relations between objects (tables in salesforce).

Exception: You cannot create a new Master-Detail relationship on an existing custom object if records already exist. You must first create a Lookup relationship, populate the lookup field with data in all records, and then change the relationship type to Master-Detail.

Rules to follow while making Master Detail Relationship

  1. Standard Object to Custom Object
  2. Custom Object to Custom Object
  3. Standard Object cannot be on the detail side
  4. Lead and User objects cannot be the part of Master Detail relationship

In case if you have some records inserted already and later you want to establish Master Detail relationship then first you need to create the lookup relationship and relate each record, then change the relationship type to Master-Detail.

For many to many relationship you have to create third table(Junction Object) with id fields of each table.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .