2

Trying to convert a managed extension package to SFDX but I've run into a problem. I've converted the project using

sfdx force:mdapi:retrieve
and
sfdx force:mdapi:convert

If we say the base managed package has a namespace of BASE and the extension managed package a namespace of EXT.

I created a new scratch org with the namespace EXT and manually installed the base managed package (BASE).

All good so far.

Now the base managed packages has an object, say BASE__AnObject__c, and the extension managed package source code wants to add a field to it called say EXT__SomeField__c. The sfdx:force:mdapi:retrieve and convert generated an objects folder like following

objects/BASE__AnObject__c/BASE__AnObject__c.object-meta.xml
objects/BASE__AnObject__c/fields/SomeField__c.field-meta.xml

When I do an sfdx:force:source:push I get an error

Error force-app/main/default/objects/BASE__AnObject__c/BASE__AnObject__c.object-meta.xml Must specify a non-empty label for the CustomObject

That file currently contains

<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
    <enableEnhancedLookup>false</enableEnhancedLookup>
</CustomObject>

I've tried filling out content in the object xml but it doesn't work and I think it's the wrong approach. I know for a standard object the that object-meta.xml wouldn't exist so I tried removing it but the sfdx force:source:push complains about it being missing.

Any suggestions on how to get the source to deploy would be appreciated.

1 Answer 1

0

You should be able to achieve this if you

  • Delete the .object-meta.xml file.
  • Create a new scratch org (I suspect source tracking is simply confused with your current one).
  • Ensure that the new scratch org contains the base managed package before deploying.

All that is required in an SFDX-format project is the fields subfolder to achieve the packaging objective you've articulated.

4
  • Thanks David. That was it. The source tracking got confused from the the first attempted deploy and never recovered. One of those beautifully simple solutions. Good thinking sir! Commented Dec 14, 2020 at 16:05
  • Say @david-reed , any ideas what to do when you actually do need to edit one thing on the managed object itself and THEN it won't let you due to errors like this? One of the custom fields has <trackHistory>true</trackHistory>, so I need to add <enableHistory>true</enableHistory> to the object, even though it's not true as delivered out of the package.
    – k..
    Commented Dec 15, 2021 at 0:36
  • 1
    @k.. Not sure I totally understand the context, open a question?
    – David Reed
    Commented Dec 15, 2021 at 0:38
  • Thanks @david-reed -- done. salesforce.stackexchange.com/questions/364251/… (question 364251 if it eats the link)
    – k..
    Commented Dec 15, 2021 at 0:52

You must log in to answer this question.

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