I keep getting the error

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

when pushing to an existing scratch org. After doing some research I have found that this is a known issue and the workaround is to add the master-detail lookup field to the deployment (even if it has not changed) to your deployment selected list.

My question is how do I do this in Salesforce DX? It seems like I need to push the Master object as well but Im not sure how to do that without making a change to the file. I have found that I can change the relationship to ReadWrite and it will push but then will fail when pushing to a new scratch org since it is suppose to be ControlledByParent.

Has anyone figured this issue out in DX?

1 Answer 1


After some tinkering I actually found a fix to that error. You just need to go to the Master objects meta file and add a space to the bottom. This will deploy both of the objects therefore fixing the error. This seems like a hack but it works.

If anyone knows anymore info about this issue or another way to fix it please post it!

You must log in to answer this question.

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