11

I have an SFDX format project that contains some components but I do not want any profiles to be present.

When I do a:

sfdx force:source:status

to see what files would transferred by a sfdx force:source:pull, I get this result:

=== Source Status
STATE           FULL NAME                                         TYPE          PROJECT PATH
──────────────  ────────────────────────────────────────────────  ────────────  ────────────────────────────────────────────────────────────────
Remote Add      IntakeRelationship__c.Intake__c                   CustomField
Remote Add      IntakeRelationship__c.Contact__c                  CustomField
Remote Add      IntakeRelationship__c.Account__c                  CustomField
Remote Add      IntakeRelationship__c.Type__c                     CustomField
Remote Add      Admin                                             Profile
Remote Add      Custom: Sales Profile                             Profile
Remote Add      Custom: Marketing Profile                         Profile
Remote Add      Custom: Support Profile                           Profile
Remote Add      IntakeRelationship__c-Intake Relationship Layout  Layout
Remote Changed  Intake__c                                         CustomObject  sfdx-source/wiz/main/objects/Intake__c/Intake__c.object-meta.xml
Remote Add      IntakeRelationship__c                             CustomObject

I have tried various .forceignore values (such as **profiles and Profile/Admin) based on How to Exclude Source When Syncing or Converting and other Googling trying to exclude the profiles. But I am now thinking that the problem may be that there is not a "PROJECT PATH" for the profiles so there is nothing to match.

How can I stop the profiles from being pulled in this case?

(Pulling them and then deleting them is not an option because then the next push will try to delete them from the scratch org.)

8

I use this line in .forceignore for that:

force-app/main/default/profiles

The path should be relative to where your .forceignore lives

  • Thanks Denis. I think **profiles amounts to the same thing but tried the full path in case and the profiles are still being listed by sfdx force:source:status... – Keith C Feb 2 '18 at 13:43
  • 1
    As described in the answer I posted the pull does work; the status doesn't present the correct information. – Keith C Feb 2 '18 at 17:27
6

Based on Denis's answer, I just went ahead and did the pull with this in .forceignore:

**profiles

and got this result:

=== Pulled Source
STATE    FULL NAME                                         TYPE          PROJECT PATH
───────  ────────────────────────────────────────────────  ────────────  ─────────────────────────────────────────────────────────────────────────────────────────────────
Add      IntakeRelationship__c                             CustomObject  sfdx-source/main/default/objects/IntakeRelationship__c/IntakeRelationship__c.object-meta.xml
Add      IntakeRelationship__c.Account__c                  CustomField   sfdx-source/main/default/objects/IntakeRelationship__c/fields/Account__c.field-meta.xml
Add      IntakeRelationship__c.Contact__c                  CustomField   sfdx-source/main/default/objects/IntakeRelationship__c/fields/Contact__c.field-meta.xml
Add      IntakeRelationship__c.Intake__c                   CustomField   sfdx-source/main/default/objects/IntakeRelationship__c/fields/Intake__c.field-meta.xml
Add      IntakeRelationship__c.Type__c                     CustomField   sfdx-source/main/default/objects/IntakeRelationship__c/fields/Type__c.field-meta.xml
Changed  Intake__c                                         CustomObject  sfdx-source/wiz/main/objects/Intake__c/Intake__c.object-meta.xml
Add      IntakeRelationship__c-Intake Relationship Layout  Layout        sfdx-source/main/default/layouts/IntakeRelationship__c-Intake Relationship Layout.layout-meta.xml
Add      Security                                          Settings      sfdx-source/main/default/settings/Security.settings-meta.xml

which is what I wanted.

So it looks like despite this documentation How to Exclude Source When Syncing or Converting saying:

The .forceignore file excludes files when running force:source:push, force:source:pull, and force:source:status. For source:status, remote changes are checked against entries in the .forceignore file. Let’s say you added a class called HelloWorld.cls on the server and included an entry in .forceignore that matches the file name (such as HelloWorld.cls or HelloWorld.*). The source:status output omits the HelloWorld.cls.

the status and pull are not consistent in this case.

5

FYI, when pulling from the scratch org and not wanting to include profiles, I found that **profiles does not work, but **profile does.

  • +1 on this. Not sure if this changed since OP selected the answer. – arbackhouse Sep 1 '18 at 1:21
2

You can also use **/profiles. The force-app/main/default/profiles will only apply to the default force-app folder, so if your DX project becomes more complex with different folders, and you want to exclude profiles from all folders, simply adding **/profiles line will exclude profiles from all folders/packages.

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.