Background: I have a problem where if I try to deploy my entire set of metadata to a newly created scratch org, it fails because the sharing settings of certain objects are incorrect by default, causing errors regarding AssetShare and OrderShare records not being available with the current sharing setup.
I can solve these issues by manually setting the sharing to the correct values, but I want to automate the entire process. I'm trying to deploy only the Asset and Order object metadata file first, containing only the sharing setting, like so:
<?xml version="1.0" encoding="UTF-8"?> <CustomObject xmlns="http://soap.sforce.com/2006/04/metadata"> <sharingModel>Read</sharingModel> <externalSharingModel>Private</externalSharingModel> </CustomObject>
I want to set both regular sharing and external sharing, which I can do manually without any issues, but when I try to deploy I immediately get the response that the deploy
Can't specify an external sharing model for Order (same thing for Asset)
I tried deploying the metadata without the externalsharing, but besides locking changes to the sharing for 15+ minutes, that only resulted in an email saying that changing the sharing was unsuccessful.
EDIT: Likely this is precisely because external sharing isn't being updated alongside it, because if I try to only edit the internal sharing and leave external as-is, I get an error in the UI saying
The default external access must be more restrictive or equal to the default internal access.