2

I am trying to convert a messy orgs metadata into a DX project with a scratch org. Converting the metadata was easy using sfdx:mdapi:convert but pushing fails as the org shape doesn't match the OrgSetting files in the settings folder.

Is there an y automated way to convert that into scratch org config settings or any other trick besides manual trial and error?

3
  • 1
    Would using the beta org shape for scratch orgs help you? You can create the "shape" details from an existing org. – Phil W Nov 25 '20 at 16:39
  • 1
    @PhilW That could have been an answer, you know. – sfdcfox Nov 25 '20 at 16:42
  • @sfdcfox, yes though only if I then added all the detail like you just did :D – Phil W Nov 25 '20 at 16:43
3

You can use Org Shape for this purpose. First, Enable Org Shape in the org you want to use as the source, set up the Permissions you need, then Create an Org Shape. Finally, specify the sourceOrg attribute in your Scratch Org Definition File.

Step 1: Enable Org Shape

As an admin, go to Setup > Org Shape > Enable. If your Dev Hub is different than the org you enable this in, enter the Org Id in the box.

Step 2: Permissions

Create Permission Sets with the following permissions:

To Manage Scratch Orgs    Object Settings > Shape Representation > Create, Delete
To Use Org Shapes         Object Settings > Shape Representation > Read, View All

Assign them to developers that need to create/delete/use Org Shapes, as appropriate.

Step 3: Create an Org Shape

sfdx force:org:shape:create -u <source org username/alias>

This creates the shape that you'll use in your Scratch Org Definition File.

Step 4: Use the Org Shape

In the configuration file, specify the org you want to use:

{
  "orgName": "Acme",
  "sourceOrg": "00DB1230400Ifx5"
}

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.