Minimal working example to demonstrate the Metadata API behaves differently when retrieving Metadata from a Scratch Org vs. other Org
Typically, when retrieving Profiles
, RecordTypes
or Translations
from an org, we only get the content for the other metadata types referenced in package.xml.
However if the org (Scratch Org or Sandbox) has Source Tracking enabled, we are getting the full content.
With source tracking, retrieving profiles returns profile information pertaining to anything else specified in the package.xml file plus any components getting tracked by source tracking. That includes any entity for which a change exists between your local project and the org.
Source: Salesforce DX Developer Guide Retrieve and Pull Changes to Profiles with Source Tracking
... the returned .profile files only include security settings for the other metadata types referenced in the retrieve request. Exceptions include user permissions, IP address ranges, and login hours, which are always retrieved.
The RecordType only contains the <picklistValues>
for the CustomField
s requested in the same retrieval.
... the files returned in the .translations folder only include translations for the other metadata types referenced in package.xml.
This repo contains a test suite to reproduce
- the default behavior for a Developer Edition
- the different behavior for a Scratch Org