Every time I push my app to a new scratch org, I'm having to go into each field of each custom object to set the field-level security and accessibility (except for the required fields). I didn't have to do this before.

Has something changed with Salesforce security/accessibility? Could I have inadvertently added something to the .forceignore file that is causing this?

I assume those settings must be somewhere in the metadata in my SFDX project, but I can't find it. I don't see it in the objects/[myobject]/fields/[field].field-meta.xml, or in the objects/[myobject]/[myobject.object-meta.xml.

  • Are you pushing the Profile along as well ? You don't have to if the profile are pushed along ? looks like a potential bug to me – Mohith Shrivastava May 22 at 16:22
  • 1
    **profiles -- that's it! Thank you. I didn't make the connection, and I had **profiles listed in my .forceignore. – PatMcClellan__c May 22 at 16:25

The issue is because you are not pushing the profiles along with the other metadata. The FLS is present in the profiles . I usually recommend to move away from profiles and go with permission sets as those are more flexible .


It's in profiles/[ProfileName].profile-meta.xml, just as it would be in the Metadata API. You need to make sure you push/pull profiles in order to get field security. You can also do so by way of the source retrieve command, such as:

sfdx force:source:retrieve -m Profile:Admin,CustomField:Account.MyCustomField__c
  • Thanks. I marked Mohith as the solution (he was first), but I do appreciate the additional info. – PatMcClellan__c May 22 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.