1

Scenario:

I'm creating an unlocked package that is dependent on 3 other packages:

  • Package A - Managed base package (1st gen managed)
  • Package B - Managed extension package (extension of base, 1st gen managed)
  • Package C - Unmanaged extension package (extension of base, 1st gen unmanaged)

Package B adds some custom fields to a custom object that is in Package A.

In my unlocked package there's a report that references some of those fields, similar to this:

<groupingsDown>
    <dateGranularity>Day</dateGranularity>
    <field>PKGA__My_CustomObject__c$PKGB__My_CustomField__c</field>
    <sortOrder>Asc</sortOrder>
</groupingsDown>

My sfdx-project.json file references packages A,B,C as dependencies in the correct order:

{
    "packageDirectories": [
        {
            "path": "force-app",
            "default": true,
            "dependencies": [
                {
                    "package": "04t............"
                },
                {
                    "package": "04t............"
                },
                {
                    "package": "04t............"
                }
            ],
            "package": "My Unlocked Package",
            "versionName": "ver 0.1",
            "versionNumber": "0.1.0.NEXT"
        }
    ],
    "name": "My Unlocked Package",
    "namespace": "",
    "sfdcLoginUrl": "https://login.salesforce.com",
    "sourceApiVersion": "51.0",
    "packageAliases": {
        "My Unlocked Package": "0Ho............"
    }
}

Error:

When I attempt to create a new version of the unlocked package using sfdx force:package:version:create I get the following error:

Invalid field name: PKGA__My_CustomObject__c$PKGB__My_CustomField__c

I haven't been able to figure out why I'm getting this error. Any ideas?

0

I recently discovered the root cause was that the report that was causing the error was using a custom report type that didn't include the fields from package B. Once I added those fields to the custom report type metadata, I was able to create the package version and release it.

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.