You need to sign in to do that
Don't have an account?
Kognoz
Metadata API: Cannot set sharingModel to ControlledByParent on a CustomObject without a MasterDetail relationship field
Hi All,
We have had a managed package for a couple of years that works alongside an external app which does remote depoyments using the Metadata API. Specifically the external app creates custom fields in 2 custom objects of the package.
These two custom objects are in a Master-Details relationship, and the OWD are Public Read/Write for the master one, and Controlled By Parent on the detail/child one.
The remote deplyments via the Metadata API use the File deployment, and in the XML for the detail/child object we always included the XML:
<sharingModel>ControlledByParent</sharingModel>
In the last couple of weeks this has been causing the remote deployments via the Metadata API to fail with the following message:
Cannot set sharingModel to ControlledByParent on a CustomObject without a MasterDetail relationship field
It looks that something has changed in the way the Metadata API works. Could somebody shed some light into it ?
Thanks
Fernando
We have had a managed package for a couple of years that works alongside an external app which does remote depoyments using the Metadata API. Specifically the external app creates custom fields in 2 custom objects of the package.
These two custom objects are in a Master-Details relationship, and the OWD are Public Read/Write for the master one, and Controlled By Parent on the detail/child one.
The remote deplyments via the Metadata API use the File deployment, and in the XML for the detail/child object we always included the XML:
<sharingModel>ControlledByParent</sharingModel>
In the last couple of weeks this has been causing the remote deployments via the Metadata API to fail with the following message:
Cannot set sharingModel to ControlledByParent on a CustomObject without a MasterDetail relationship field
It looks that something has changed in the way the Metadata API works. Could somebody shed some light into it ?
Thanks
Fernando
The resolution is to add the "MasterDetail relationship field" into the change set, even if you haven't changed it or the Sharing / OWD.
I'm assuming if you don't have the custom field in your package / object in the IDE either, then you'd probably get the same error.
All Answers
The resolution is to add the "MasterDetail relationship field" into the change set, even if you haven't changed it or the Sharing / OWD.
I'm assuming if you don't have the custom field in your package / object in the IDE either, then you'd probably get the same error.
After some trial and error iterations we added the master field to the detail deplyment file, even if it already exists in the target org, and that did the trick. So it looks that indeed there has been a change in the way the Metadata API works for deployments of custom fields which are in a Master-Detail relationship.
Thanks !
Thanks for sharing your experience. really helpful to me and my team :)
-Nihar
Could you explain it how to do it.
I've created another changed set for this and added the object.
What would be the next step to add the masterdetail field.
Thank you
Venkat
When selecting what to add to your change set, select custom fields and then select the field that defines master-detail relationship.
Ian's solution worked for me
hello everyone.
I am getting error message as above when deploying Salesforce through Azure - Cannot set sharingModel to ControlledByParent on a CustomObject without a MasterDetail relationship field.
So as suggested I had included the master detail relationship field in the object's meta.xml and now the error message is changed to 'Duplicate name 'vlocity_cmt__OrchestrationItem__c.vlocity_cmt__OrchestrationPlanId__c' specified
ERROR running force:mdapi:deploy:report: The metadata deploy operation failed.'
Please advice
Regards,
Lakshmi