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

Jason Mann on October 27th 2015


Solving the Salesforce bug: Master-Detail fields must always be included in deployments

Some objects in Salesforce organizations are linked through relationships. These relationships are managed through custom fields and determine how the objects handle data deletion, record ownership, security and required fields in page layouts (see Salesforce developers guide). One relationship type is Master-Detail. This is a one:many relationship type in which the master (or parent) object controls certain aspects of the behaviour of the detail (child) objects.

There is a known Salesforce bug with master-detail relationships which is a common deployment failure point for many users. It affects ChangeSets and the Force.com migration tool, and any other tool which uses the metadata API.

The bug

In theory, when a change is made to a detail object which does not change the Master-Detail field, the Master-Detail field does not need to be included in the deployment. Users who have been trying this, however, are met with the following error when they run a deployment: “Cannot set field to ControlledByParent on a CustomObject without a MasterDetail relationship field”.

To workaround this bug, the Master-Detail relationship field always needs to be included in the deployment, regardless of if there is any change to it. If it isn’t included, the deployment will fail.

How Gearset solves the problem for you

As part of our ongoing efforts to improve Gearset Deploy, we’re happy to announce that this week we updated the dependency analysis engine to automatically detect and work around this bug. When running a deployment with a child object with a master-detail relationship, Gearset Deploy will automatically include the Master-Detail relationship field in the deployment, even if there has been no change to it. This will ensure your deployments don’t fail as a result of this bug.

It’s just another way we’re simplifying Salesforce deployments.

Catching the master-detail field bug

If you want to find out more about what the future holds for Gearset, check out our product roadmap.

Ready to get started with Gearset?

Sign up now to start your completely free 30 day trial
try it now