1

I currently have a child package which adds an email alert using an object created by the parent package. The parent package has no workflows at all, there's no directory named workflows/ either and installing the package and checking the components shows no workflows visible.

However, when I try to build the package, I always get a very strange error:

$ sfdx force:package:version:create --package ChildPackage --path force-app --installationkey XXXXX --wait 10 --definitionfile config/project-scratch-def.json

(truncated)

ERROR running force:package:version:create: You're trying to include Workflow namespace__Application__c in Package ver 0.2. This component already exists in Package ver 0.1, which Package ver 0.2 depends on. You can't include the same component in both packages.

I assume that Package ver 0.2 is the child object and Package ver 0.1 is the parent object which matches their actual version.

Details about the environment:

  1. Both packages are attached to the same dev hub
  2. Both packages created with this command: sfdx force:package:version:create --package PackageName --path force-app --installationkey XXXXX --wait 10 --definitionfile config/project-scratch-def.json
  3. I'm trying to install them to a temporary scratch org - the parent package installs fine, the child package fails

Here's the sfdx-project.json

{
    "packageDirectories": [
        {
            "path": "force-app",
            "default": true,
            "package": "ChildPackage",
            "versionName": "ver 0.2",
            "versionNumber": "0.2.0.NEXT",
            "dependencies": [
                {
                    "package": "ParentPackage",
                    "versionNumber": "0.1.0.LATEST"
                }
            ]
        }
    ],
    "namespace": "namespace",
    "sfdcLoginUrl": "https://login.salesforce.com",
    "sourceApiVersion": "47.0",
    "packageAliases": {
        "ChildPackage": "0HoXXX",
        "ParentPackage": "0HoXXX",
        "[email protected]": "04tXXX",
        ... multiple versions of ChildPackage ...
    }
}

Here is the project-scratch-def.json:

{
  "adminEmail": "XXX",
  "edition": "Developer",
  "features": [
    "Workflow",
    "Communities",
    "Sites"
  ],
  "settings": {
    "lightningExperienceSettings": {
      "enableS1DesktopEnabled": true
    },
    "communitiesSettings": {
      "enableNetworksEnabled": true
    }
  }
}

1 Answer 1

0

I got the answer here: https://success.salesforce.com/_ui/core/chatter/groups/GroupProfilePage?g=0F93A000000HTp1SAG&fId=0D53A00004Y40q1SAB

There is a known bug for this. If you have an object (abc__c) in a base package (PackageA) and then you try to add a workflow for that object in a dependent package (PackageB) and PackageB is defined to depend on PackageA, you will get this error. Workarounds include, having both the object and the workflow in one package or deploying the workflow via the MDAPI instead of packaging it

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .