When trying to deploy an update to a custom object from Sandbox to Production in Salesforce, you may receive the following error:
"Cannot set sharingModel to ControlledByParent on a CustomObject without a MasterDetail relationship field."
This error occurs when deploying a child object in a Master-Detail relationship without including its Master-Detail relationship field in the deployment package. For example, if you have ObjectA (the master) and ObjectB (the child object with a Master-Detail relationship field pointing to ObjectA), and you deploy only ObjectB's metadata without its Master-Detail field, Salesforce cannot validate the sharing model (ControlledByParent) because the relationship field is missing from the deployment.
This error typically occurs when deploying only the child object (ObjectB) without including its Master-Detail relationship field, even if that field itself has not changed.
To resolve this error, add the Master-Detail relationship field from the child object (ObjectB) to your deployment package, even if the field has not been modified.
In Salesforce, a "Change Set" is a deployment tool used to move metadata such as custom objects and fields from one Salesforce org to another (for example, from Sandbox to Production). To add the required field to your Change Set:
After including the Master-Detail field in the deployment, the error will not occur.
000386883

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.