Error: CustomField Not in package.xml when defining custom field in child managed 2gp from a custom object created in parent managed2gp under the same namespace
Summary
I am not able to install a child managed 2gp version that has a custom field in a custom object from its parent managed 2gp (in the same namespace). Getting Error: CustomField Not in package.xml for that custom field when trying to install the package. Creation of the package (even with validations) does not fail
Steps To Reproduce
IMPORTANT 1-Create a parent 2gp managed package A under namespace nmsp, and create a custom object O. Create a new beta version for this package 2-Create a child 2gp managed package B. Create dependency between package A and B (we are using cumulusCI), and create in custom object O a field F. The field F will be stored in force-app/main/default/nmsp__O/F__c.xml-meta.... 4-Create new package version for package B with NO validation skip. Package can be created successfully 5-Install package version in new scratch org empty. CumulusCI is successfully installing all dependencies, but when trying to install metadata, getting the following errors:
Error: CustomField Not in package.xml, Details: O__c.F__c: Not in package.xml
Expected result
I should be able to successsuly install package
Actual result
Cannot install package (error)
Additional information
System Information
@salesforce/cli/2.78.3 darwin-arm64 node-v20.17.0
Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.
Hello @jorgesolebur :wave: It looks like you didn't include the full Salesforce CLI version information in your issue.
Please provide the output of version --verbose --json for the CLI you're using (sf or sfdx).
A few more things to check:
- Make sure you've provided detailed steps to reproduce your issue.
- A repository that clearly demonstrates the bug is ideal.
- Make sure you've installed the latest version of Salesforce CLI. (docs)
- Better yet, try the
rcornightlyversions. (docs)
- Better yet, try the
- Try running the
doctorcommand to diagnose common issues. - Search GitHub for existing related issues.
Thank you!
If you verified that package version B was created with the CustomField then the quickest way to a solution is to open a support case so that the packaging team can investigate since this appears to be a server side issue.
You can also ask for help in one or both of these communities:
- post on the Partner Community: https://partners.salesforce.com/_ui/core/chatter/groups/GroupProfilePage?g=0F93A000000HXAq
- post on the Salesforce DX Community: https://trailhead.salesforce.com/trailblazer-community/groups/0F93A000000HTp1SAG?tab=discussion&sort=LAST_MODIFIED_DATE_DESC
Thanks @shetzel . Quick question - how can I check if the package B contains the custom field? Since isntallation fails I cannot check the installed components screen... can I check this anywhere in the devhub org?
Will post in the meantime in the link you shared
I think it should be listed in the dev hub's packages but if not you can add the --preserve flag to the package version create command and inspect the intermediary files created as part of the package version creation.
Nice, thanks for the trick. Let me check it. For now I think it is SF CLI issue, but let me see if preserve gives a little bit more details, and I will share more insights later today.
Still completing the tests with --preserve flag