When I pull down metadata from my production org (which is my devhub org), I have issues with scratch org metadata meddling with my repo. For example I have custom profiles that were created on the org the have

force-app/main/default/profiles/Custom User.profile-meta.xml        
In field: layout - no Layout named ActiveScratchOrg-Active Scratch Org Layout found (198:24)

This is because that profile now has the following:

    <layout>ActiveScratchOrg-Active Scratch Org Layout</layout>

I imagine if this was correctly created in a scratch org in the first place this may not have happened but will this lead to an issue when I deploy to production eventually? Not to mention that this continues the eternal salesforce cosmic battle for "the source of truth"

1 Answer 1


The only way I can think of to do this is to build a package.xml using version 39.0 (?) or lower (so that you don't get all the profile metadata), and explicitly specify which object/fields you want to retrieve. This should provide you with usable profiles that you can use to deploy other places. Unfortunately, if you have a complicated setup, like we do, it may take a few days to properly build the package so you're not missing anything. A slightly better way may be to build classic package, add all of the elements you want to download, then retrieve it based on the package name (e.g. sfdx force:mdapi:retrieve -p All -a 39.0, where All is the name of the package you created, and 39.0 is the metadata API version to use).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .