1

How to exclude objects from other packages (prefix) in sfdx? Since I created a dependent unlocked package when I add custom fields to objects of the "needed/parent" package when I retrieve the custom field sfdx also retrieves the object which later results in an error since we cannot overwrite components of another package.

How kan ik exclude objects from another package?

** Update:

My .forceignore file is in the root folder of my project.

  • I created a map ignore under the default map
  • I tried adding /force-app/main/default/ignore to the .forceignore file
  • I tried adding force-app/main/default/ignore .forceignore file

I get the same error : Must specify a non-empty label for the CustomObject

Which is resolved if I remove the object of the other package from my package

** Update:

Here is my force ignore file this is at the root of my project

# .forceignore v2
# List files or directories below to ignore them when running force:source:push, force:source:pull, and force:source:status
# More information: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_exclude_source.htm
#

package.xml
force-app/main/default/ignore
# LWC configuration files
**/jsconfig.json
**/.eslintrc.json

# LWC Jest
**/__tests__/**

2 Answers 2

0

Manually move the object files into another directory after retrieval and add the new directory into the .forceignore

3
  • Thanks for your answer please check my update this is not working
    – Thomas
    Dec 1, 2021 at 11:38
  • @Thomas Can you add an example of what you are specifying? It might be worth to look into your folder structure and the XML you have. Dec 2, 2021 at 0:18
  • I added my force ignore file, What/which do you mean with XML
    – Thomas
    Dec 7, 2021 at 6:21
0

For anyone who bumps into this issue my findings:

  1. There is a difference between os systems windows uses \ in the gitignore and mac /
  2. Add the directory path and filename to the force.ignorefile after retrieval. Do not move the files after retrieval into a new directory since after a new retrieval the files will be retrieved in the original map and will still cause issues.

Example (mac):

force-app/main/default/objects/abcrec__abcAttachment__c/abcrec__abcAttachment__c.object-meta.xml

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.