sfdx/sf plugin to read Metadata e.g. full Profiles via CRUD Metadata API
For certain Metadata Types there is a different behaviour of the file-based vs. CRUD-based Metadata API.
This plugin provides a sf force source read
command to read Metadata using the "CRUD-based" Metadata API similar to sf force source retrieve
(which uses the "file-based" Metadata API).
Note
This plugin simply returns the unfiltered response from the CRUD-based Metadata API.
sf plugins install sfdx-plugin-source-read
sf force source read -m "Profile:Admin"
sf force source read -p force-app/main/default/profiles/Admin.profile-meta.xml
sf force source read -m "RecordType:Account.Business"
sf force source read -p force-app/main/default/objects/Account/recordTypes/Business.recordType-meta.xml
When retrieving Profiles, the file-based Metadata API behaves differently for source-tracked and non source-tracked orgs:
Without source tracking, retrieving profiles only returns some profile information
a.k.a. a minimal Profile containing only userPermissions
and entries for components listed in the package.xml
of the retrieve request.
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
a.k.a. a more kind of "full" Profile containing entries for all metadata having a SourceMember
record in that org.
The CRUD Metadata API shows yet another behaviour:
It returns a kind of "full" Profile independent of source tracking and even containing entries for metadata from Managed Packages etc.
Warning
Unfortunately Profiles might include tabVisibilites
for tabs not available in the org (see #66).
Without further processing this will cause deployment errrors.
Currently this has been tested only for Profiles
and RecordTypes
.