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
Tristan BakerTristan Baker 

Maximum depth exceeded error

Hello,

I can't figure out what the problem is.  What's weird is that I've successfully created my schema in my sandbox environment with no issues.  I attempted to deploy my custom objects just now, and i recieved a similar looking error.

Service_Repair_Line_Item__c.Product_Repair_Line_Item__c Custom Field 65 13 maximum depth of master-detail relationship exceeded
Service_Repair_Line_Item__c Custom Object   Cannot set ControlledByParent on a CustomObject without a MasterDetail relationship field


I've included a screen shot of the schema I've created at the bottom of this post.  I count only 5 chained master-detail relationships: Accounts->Contact->Service Order->Product Repair Line Item->Service Repair Line Item.  Elsewhere on this forum (https://success.salesforce.com/answers?id=90630000000h1QXAAY), i've seen some references to the fact that 5 is the maximum depth of a Master-Detail relationship, so it would appear I am within that limit  I don't understand why its complaining during the production deployment but isn't complaining in my sandbox.  I also don't understand why it complaining about just the Service Repair Line Item, because there are 3 other sibling objects that live at the same depth.  Is it possible that there is a different limit in the sandbox than there is in the production environment?

Object Schema
ShashForceShashForce
Hi Tristan,

Please send me your production and sandbox org IDs at ssrivatsavaya@salesforce.com and I will check the existing limits for you.

Thanks,
Shashank
Tristan BakerTristan Baker
Hi Shahank - just sent you an email with the details you requested.  I really appreciate your offer to help.
ShashForceShashForce
The limits look same in production and sandbox. You may want to check the schema in production as well, whether it looks exactly the same as in sandbox. If still you get the error, I would suggest you to raise a case with Salesforce Support.
System Admin 84System Admin 84
Tristan, were you able to find out what was causing this?  I'm having the same problem.  Not only does it not deploy but I am unable to manually create a master-detail to an object in Production whereas I was able to do it in the Sandbox.
Ian StockIan Stock
I've had the same problem for a few weeks now, and stumbled on the resolution to "Cannot set sharingModel to ControlledByParent on a CustomObject without a MasterDetail relationship field" when deploying through change sets. I wasn't having the problem through the IDE.
The resolution is to add the "MasterDetail relationship field" into the change set, even if you haven't changed it or the Sharing / OWD.
I'm assuming if you don't have the custom field in your package / object in the IDE either, then you'd probably get the same error.