Skip to main content
All CollectionsTroubleshooting & FAQsCommon Salesforce Deployment Errors
Cannot set sharingModel to ControlledByParent on a CustomObject without a MasterDetail relationship field
Cannot set sharingModel to ControlledByParent on a CustomObject without a MasterDetail relationship field

Deploying the detail of a master-detail relationship

T
Written by Tam Tran
Updated over a year ago

Root cause:

This is a Salesforce known issue when deploying object with MasterDetail relationship.

Assume you have two objects Invoice and InvoiceItem with InvoiceItem being a child of Invoice. InvoiceItem.Parent_Invoice is a master-detail lookup to Invoice. If you only deploy InvoiceItem, the above error will occur.

Workaround:

Add the object referenced in the master-detail lookup field to the deployment (even if it has not changed) to your deployment selected list.

In the example above, add InvoiceItem.Parent_Invoice to the list, in addition to InvoiceItem object.

Did this answer your question?