Skip to main content

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

 Scenario:We have created a new object which has a Master-detail relationship with Account. When deploying a new object to the target organization, The deployment fails with the error message "Cannot set sharingModel to ControlledByParent on a CustomObject without a MasterDetail relationship field"

 

Solution:

What we did wrong:

When creating change set, We have added the object , but did not add the Master-detail relationship field.

What's is happening in background:

Every object has a field "Sharing Model" which denotes the organization-wide-default of the object. When we create a Master detail relationship in any object, The Sharing Model field is automatically set to "ControlledByParent" which means that the access to the records' of the object is determined by the access to the parent's record.

So when you add this object alone in the change set without adding the Master-detail relationship and try to deploy the object, It is reasonable to get this error.

How to fix the error:

Now You know how to fix the error. Just add the object along with Master-detail relationship field in
change set and deploy it.

Bye Friends.

Comments

  1. The issue can also be resolved by changing the master-detail relationship to a lookup relationship.

    ReplyDelete

Post a Comment