sfdx force:source:pull loses Field Level Security
Last updated 14 days ago ·Reference W-4976080 ·Reported By 76 users
For SFDX pull requests, for field changes, pulled profiles lose previous Field Level Security from profile xml
1. Login to your environment
sfdx force:auth:web:login -d -a DevHub
2. Create your project:
sfdx force:project:create -n c:\project-myprojpullrepro
3. CD to your project directory and create a scratch org:
sfdx force:org:create -s -f config/project-scratch-def.json -a scratchOrg1
Success message is returned with your username
4. Login to the scratch org
sfdx force:org:open -u firstname.lastname@example.org (user your username here from step 3)
5. Once it opens the org in browser , create a field on any object, e.g. Create a custom text field on Account named "Field A"
Add Field Level Security for Profiles.
6. Run a pull
7. Navigate to the profiles folder in your project directory:
and open any profile xml for which FLS was added at step 5 , notice that the FLS exists for Field A
8. Now go back the browser where you are logged into the scratch org, and create another Text field on Account, Field B same as we created Field A above.
9. Do another pull and then open the same profile as step 7, notice that the previous FLS for Field A is gone and only contains FLS for Field B.
Use Metadata API
Fix profile xml manually
Reported By (76)
Is it Fixed?
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.