Managed second generation package version creation fails when using ancestry and formula fields/custom metadata type
Last updated 2019-10-12 ·Reference W-5626862 ·Reported By 8 users
Managed Second Generation Package version creation fails if the version has an ancestor and if the metadata has custom metadata type in it or when using ancestor and formula fields
1) Create version 0.1 of a managed package.
2) Promote the package version to released.
3) Create version 0.2 with 0.1 being the ancestor without making any change to the metadata.
The package version fails with:
ERROR: obj1__c.f2_formula__c: Cannot modify managed object: entity=CustomFieldDefinition, component=00N19000002K6Qv, field=AggregateRelationshipName, state=released.
Package version created for version 0.2 succeeds.
++++++++++++++++++ Repro with Custom Metadata types ++++++++
1) Create a 2GP managed package - sfdx force:package:create -t Managed -n 2GP-pkg1 -r force-app
2) Create a 2GP package version - sfdx force:package:version:create -p 2GP-pkg1 -x -w 15
3) Promote the package version - sfdx force:package:version:promote -p 2GPemail@example.com
4) Update the sfdx-project.json and add this in the packageDirectories section - "ancestorId": "2GPfirstname.lastname@example.org"
5) Create a 2GP package version - sfdx force:package:version:create -p 2GP-pkg1 -x -w 15
Package Version succeeds
ERROR: MyCMDT__mdt.Mandatory_Field__c: You can't create required custom fields, or mark existing custom fields required, on custom metadata types once they've been released in a managed package.,MyCMDT__mdt-MyCMDT Layout: In field: field - no CustomField named MyCMDT__mdt.Mandatory_Field__c found,MyClassTest: Dependent class is invalid and needs recompilation:
Class db_0102_ns1.MyClass :
SELECT Mandatory_Field__c, Optional_Field__c
ERROR at Row:1:Column:8
No such column 'Mandatory_Field__c' on entity 'db_0102_ns1__MyCMDT__mdt'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.,MyClass: SELECT Mandatory_Field__c, Optional_Field__c
Is it Fixed?
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.