I am trying to deploy an update to a custom object. The object and classes associated with it work perfectly in my sandbox, but when I try to deploy, I get the following error:

Cannot set sharingModel to ControlledByParent on a CustomObject without a MasterDetail relationship field

The object has two fields of Master-Detail type, one is Contact, which I left default sharing and one is another custom object which I set to Read Only.

On the object itself I unchecked sharing in the hope that would help.

Does anyone have any idea what I can do here?

Thank you!

  • Have you included all of your object's fields in your deployment, or just the object itself? Sep 24, 2014 at 10:28

2 Answers 2


This is a recent issue with Salesforce. To workaround this issue, please add the master detail field (even if it has not been changed) to your deployment and the error will go away.

I have already filed a Case with Salesforce and they are working on it.

Salesforce knowledge article link

  • Can you please provide a link to that Case? Dec 9, 2014 at 20:03
  • 3
    I also would like the link, or if you have posted to the Salesforce Community website. Its 2016 and this issue hasn't been fixed. Feb 23, 2016 at 23:22
  • Seems I still get this issue... any update on it yet? please. Jan 16, 2017 at 9:17
  • But what do you do when you cannot see the object on the list, to be added to the changeset
    – user853710
    Mar 25, 2017 at 13:32
  • 1
    It's 2020 and I'm still getting this error - now with scratch orgs too! :) Nov 17, 2020 at 20:16

I had the same problem. First I deployed the custom object without the fields and hence the deployment failed. Then I came across this post, did not understand it well, but I assumed to add the custom fields of the custom object in the change set as well as the custom object and it worked.

So we need :

  1. The custom object to be added to the change set
  2. The custom fields of that custom object to be added as well to the change set.

I just don't know why salesforce are separating the custom fields from the custom object. Thans sridhar for the hint

You must log in to answer this question.

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