[SalesForce] Why is there a big difference in profiles returned by “sfdx force:source:pull” and “sfdx force:mdapi:retrieve”

I have a project with a scratch org created using some profiles that date from the MDAPI days. The profiles look good in the org.

Having added some record types, I expected:

sfdx force:source:pull

to do a good job of pulling the profiles back. But the profiles are about 1/3 the size of the original ones, and are missing many elements such as applicationVisibilities and recordTypeVisibilities needed for the source to be pushed in our CI (Continuous Integration) environment.

Resorting to:

sfdx force:mdapi:retrieve

and doing some manual cut and pasting of just the profiles appears to solve the problem.

What is your experience in this area? Is there something I have missed here (release notes, known issues)? I am using the latest version of SFDX and the plugins.

PS

Just added a field and did another sfdx force:source:pull with this result:

Element                  Pull Result
*******                  ***********
applicationVisibilities  missing
classAccesses            missing
fieldPermissions         expected 1862, but only 1368
layoutAssignments        missing
objectPermissions        missing
pageAccesses             missing
recordTypeVisibilities   missing
tabVisibilities          missing
userPermissions          OK
userLicense              OK

Best Answer

I went to the Metadata Coverage Report and searched for Profile. It showed up two Known Issues for Profile:

Those might explain some of the dependencies that you are encountering.

Related Topic