1

Here's a doozy:

I am extending HealthCloud with an unlocked package. I created two flexipages and search layouts for objects that belong to the HealthCloud package.

In order to add these flexipage and searchlayout assignments to my package, I have the commit the .object file for those two objects that don’t belong to me.

Everything works well (even trying to create new scratch orgs and pushing this metadata into them) until I try to create the package.

sfdx force:package:version:create --path force-app/ --codecoverage --installationkeybypass --wait 60 --definitionfile config/healthcloud-scratch-def.json --json

At that point, I get this error for each object:

You're trying to include CustomObject in Package ver 1.2. This component already exists in Package null, which Package ver 1.2 depends on. You can't include the same component in both packages.

My sfdx-project.json looks like this:

{
    "packageDirectories": [
        {
            "path": "force-app",
            "default": true,
            "package": "My Package Name",
            "versionName": "ver 1.2",
            "versionNumber": "1.2.0.NEXT",
            "dependencies": [
                {
                    "package": "HealthCloud"
                },
                {
                    "package": "HealthCloud-UnmanagedExtension"
                }
            ]
        }
    ],
    "packageAliases": {
        "HealthCloud": "04t1C000000go7oQAA",
        "HealthCloud-PreRelease": "04t1C000000go7oQAA",
        "HealthCloud-UnmanagedExtension": "04t5w0000048cTh",
        "MyPackageName": "0Ho1U000000GmozSAC"
    },
    "namespace": "",
    "sfdcLoginUrl": "https://login.salesforce.com",
    "sourceApiVersion": "48.0"
}

When I released version 1.1 of this package I had accidentally included .object files as well. The package worked correctly when I removed those. However, now, because of the flexipage and searchLayout assignment, I do need them.

How can I create this package and/or work around it? I am trying to avoid post-deploy manual steps.

1

You can include "extensions", such as adding fields, but I'm pretty sure you can't include things like overrides in the object metadata. Unfortunately, some post-deployment steps are still necessary.

| improve this answer | |
  • Yep, I've added fields and VRs... but these nodes only exist in the object file itself and it doesn't look like I can just deploy the override nodes by themselves – Sebastian Kessel May 19 at 17:33
  • 1
    Note that this does work when pushing to SO... they just fail on package creation – Sebastian Kessel May 19 at 17:33
  • 1
    This has been acknowledged and logged as an investigation for the "Unlocked Package" R&D Team. In the future, if you end up raising a case mention this number W-7599906. I will keep updating this thread as I hear more from product teams. – Mohith Shrivastava May 21 at 0:28
  • 1
    @MohithShrivastava Thanks for following up. – sfdcfox May 21 at 1:11

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.