3

I have created a scratch org. In the scratch org I have created some fields and access was given to Admin profile.

Then I pulled those changes via sfdx force:source:pull so Admin profile also came. I don't want to commit any changes of admin profile since, I will go with permission set, so I ignored the changes and only committed necessary changes to git repo.

Now when I am pushing complete source to scratch org I am getting below error:

force-app/main/default/profiles/Admin.profile-meta.xml  cannot delete profile

I event don't have profiles folder under default folder. I am not sure what might be causing this issue. Any pointers would be really helpful.

6

The fact that you do not have profiles in your local machine suggests to DX that you are trying to delete the profile from the server.

In SalesforceDX the local source superceedes the server source.

If you want to skip the profile files from being pushed to the scratch org, I would suggest to do the following:

  1. Bring back the profile folder and the profile file as it was. One way to get this back is to run sfdx force:source:pull --forceoverwrite
  2. Exclude the Admin.profile by adding it to the .forceignore file in your root of the project (create one if necessary) and add the path to the profile(s) to exclude the file(s).

For example, below is what your .forceignore file would contain for the "Admin" profile:

<appName>/main/default/profiles/Admin.profile
<appName>/main/default/profiles/Admin.profile-meta.xml

Here <appName> is your application folder name.

  • But how does it know even to deploy these profile files? Would it not be an option to edit this 'local source' you're referring to? – Marco Pietersen Feb 15 at 13:48

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.