7

I'm currently trying to create a scratch org which reflects our ludicrously complicated production org which contains hundreds of Roles.

Upon deploying most of these, I get errors like:

Error src/roles/WhateverUser.role WMSportCustomerUser field integrity exception: unknown (Opportunity access level below organization default)

I guess this means I need to correctly configure the OWD before these roles can be deployed.

Is there any way to do this using metadata (preferably "mdapi" since we aren't ready to move to "source" yet)?

6

Yes. Each object has two fields, "sharingModel" and "externalSharingModel". You can import and export these values between orgs. You'll find this setting in the CustomObject metadata. I personally use this method to set up the sharing model for standard and custom objects. There's some weird bugs around it sometimes, so some manual setup may still yet be required, but it mostly works okay.

<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
  ...
  <sharingModel>Read</sharingModel>
</CustomObject>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.