5

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.

2
  • 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 May 22, 2019 at 16:22
  • 1
    **profiles -- that's it! Thank you. I didn't make the connection, and I had **profiles listed in my .forceignore. May 22, 2019 at 16:25

2 Answers 2

5

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 .

8

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
2
  • Thanks. I marked Mohith as the solution (he was first), but I do appreciate the additional info. May 22, 2019 at 16:37
  • i tried to pull Profile using right click menu and no field came. This command was the only solution sfdx force:source:retrieve -m Profile:Admin,CustomField:Account.MyCustomField__c @sfdcfox Thanks!
    – PAS
    Mar 6 at 19:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .