2

I am trying to create a package version using Salesforce DX for a package that includes EDA 1.103 as a package dependency, but when I attempt to create a package version, I got the following error:

ERROR running force:package:version:create: An error occurred while trying to install a package dependency, ID 04t1R000001E42D: Accounts Missing Organization Feature: Account.RecordType

I was able to resolve this error by updating my sfdx-project.json to add a reference to my definition file:

"definitionFile": "config/project-scratch-def.json",

and specify default record types in my scratch org json file:

    "account": {
        "defaultRecordType": "default"
    }

I now see the following error which I am unable to resolve:

sfdx force:package:version:create:report -i 08c4W000000PAv2QAG
=== Package Version Create Request
NAME                           VALUE
─────────────────────────────  ──────────────────
ID                             08c4W000000PAv2QAG
Status                         Error
Package Id                     0Ho4W000000TNAxSAO
Package Version Id
Subscriber Package Version Id
Tag
Branch
Created Date                   2020-09-07 01:23
Installation URL
=== Errors
(1) An error occurred while trying to install a package dependency, ID 04t1R000001E42D: Unexpected Error, Details: The package installation failed. Please provide the following information to the publisher:  Organization Name: SFDX Build Org Organization ID: 00D2D000000Da3v Package: EDA Version: 1.103 Error Message: The post install script failed.

On github I noticed that that the unpackaged/post directory has record types for course connection and case, so I added more defaultRecordType entries:

attempt 1

    "case" : {
      "defaultRecordType": "default"
    },
    "course_enrollment__c": {
      "defaultRecordType": "default"
    },

attempt 2

    "case" : {
      "defaultRecordType": "default"
    },
    "hed__course_enrollment__c": {
      "defaultRecordType": "default"
    }

However, I now get the following error, which I cannot remove at all, _even after removing references to hed__course_enrollment__c and course_enrollment__c from my project-scratch-def.json file

ERROR running force:package:version:create:  Course_enrollment__c.Default: Not in package.xml,Hed__course_enrollment__c.Default: Not in package.xml

I have successfully verified that if I create a package version without validation, I am able to install it successfully, after installing EDA.

Can someone tell me what files or Salesforce orgs I need to update to be able to create a verified package version with EDA as a dependency successfully?

Additional background (optional reading)

I already had scripts that can install EDA to my scratch org and I am able to push my source to the scratch org successfully. My scripts use force:mdapi:deploy to deploy EDA pre-installation metadata which allows to me to overcome these same errors I would see when trying to install EDA

I tried removing EDA as a dependency and creating a package version but that doesn't work either. My package includes Apex classes that explicitly reference EDA custom fields so I get an error like this (some details scrubbed) when I try to create a package version without EDA as a package dependency:

ERROR running force:package:version:create:  MyProductPushToMyIPaaS: Invalid type: hed__Address__c,MyProductPushToMyIPaaS: Invalid type: hed__Address__c,MyProductPushToMyIPaaS: Invalid type: hed__Address__c,MyProductMarshaller: Method does not exist or incorrect signature: void writeObjectField(String, List<hed__Address__c>) from the type System.JSONGenerator,MyProductMarshaller: Invalid type: hed__Address__c,MyProductMarshaller: Invalid type: hed__Address__c,MyProductPushToMyIPaaS: Invalid type: Schema.hed__Address__c,MyProductPushToMyIPaaS: Invalid type: hed__Address__c,MyProductMarshaller: Invalid type: hed__Address__c,MyProductContactAfterUpdate: Variable does not exist: MyProductPushToMyIPaaS,MyProductContactAfterInsert: Variable does not exist: MyProductPushToMyIPaaS,MyProductPushToMyIPaaSTest: Dependent class is invalid and needs recompilation:
 Class MyProductPushToMyIPaaS : Invalid type: hed__Address__c,MyProductPushToMyIPaaS: Variable does not exist: addressPerContact,MyProductPushToMyIPaaS: Variable does not exist: lookupAddress,MyProductPushToMyIPaaS: Variable does not exist: addressPerContact,MyProductPushToMyIPaaS: Variable does not exist: addressList

Based on responses to an earlier question I asked about installing EDA in a Salesforce DX project, I put together a simple batch file that installs EDA via Salesforce DX by first deploying the metadata in the pre folder

echo ***** Install EDA 1.103 into default scratch org *****
echo ***** Step 1: Install EDA pre-requisites *****************
call sfdx force:mdapi:deploy -w -1 -d eda\unpackaged\pre\acc_record_types
call sfdx force:mdapi:deploy -w -1 -d eda\unpackaged\pre\contact_key_affl_fields
echo ***** Step 2: Install EDA 
call sfdx force:package:install -p 04t1R000001E42DQAS -w 5
echo ***** Step 3: Push local source to scratch org
call sfdx force:source:push

My sfdx-project.json file includes the following:

{
    "namespace": "",
    "sfdcLoginUrl": "https://login.salesforce.com",
    "sourceApiVersion": "49.0",
    "packageDirectories": [
        {
            "path": "contact-eda",
            "default": true,
            "package": "PackageAlias",
            "versionName": "VersionName",
            "versionDescription": "VersionDescription",
            "versionNumber": "VersionNumber",
            "dependencies": [
                {
                    "package": "EDA@1.103.0.12"
                }
            ]
        }
    ],
    "packageAliases": {
        "EDA@1.103.0.12": "04t1R000001E42DQAS",
        "PackageAlias": "0Hof4000000KyweCAC"
    }
}

My scratch org configuration file specifies a default account record type, and the RecordTypes feature:

{
  "orgName": "Demo company",
  "edition": "Developer",
  "features": ["RecordTypes"],
  "objectSettings": {
    "account": {
        "defaultRecordType": "default"
    }
}
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.