I have a junction object(JuncObj) with a custom object(ParentObj1) and contact as the masters. I've created a separate obj(NewChildObj) that is supposed to be a child object of JuncObj. When I create a master detail relationship on NewChildObj, JuncObj doesn't appear on the list of object. What could be the problem? When I try this as a lookup, JuncObj is available. I really need NewChildObj as a child object with a master detail relationship so that I can make use of rollup summaries but I can't seem to figure why this is not allowed. I've read you cannot have more than 2 master detail relationships on an object, but does this mean a junction object cannot have a child object via a master detail relationship?

  • This is a limitation from salesforce. If an object is child in any of the master detail relationship, it can atmost participate in 2 master detail relationship. What you can do is, change the MD relationship to lookup for the JuncObj->ParentObj1 and JuncObj->Contact, if you don't need the MD relationship there. Jan 24 '17 at 9:50

As per the help article:

Custom junction objects can't have detail objects. That is, a custom junction object can't become the master object in a multilevel master-detail relationship.

I strongly suggest you to go through the full article and understand all other considerations.

For your case, you can create junction object using lookup relationship instead of M-D, and then create M-D between NewChildObj and JunctionObj. Does that work?

  1. Create a lookup from the child object to the parent object.

  2. Populate ALL the records with a valid lookup value to the parent.

  3. Change the Lookup relationship to a Master - Detail relationship. This is only allowed if ALL RECORDS HAVE A VALID LOOKUP. Otherwise you'll get the error you describe.

Also please check below link:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.