4

I have setup three sfdx second gen packages, each with their own sub folder in my umbrella project folder.

Package 1 defines some Custom Objects.

Package 2 adds some custom fields to the custom objects created by Package 1.

Package 3 holds nothing at the moment.

My sfdx-project.json lists Package 1 as a dependency for Package 2.

When I do a sfdx force:source:push it appears to successfully deploy, but the fields in the org defined by Package 2 are missing. If I change my sfdx-project.json file to list only Package 2, without any dependencies, and clear out my .sfdx/org subfolder, a sfdx force:org:push results in the following errors for my custom fields:

N/A           An object 'TP_Transaction__c.TX_VP_BillingEmail__c' of type CustomField was named in package.xml, but was not found in zipped direc
tory

There a multiple errors as above, for each custom field defined in Package 2. The initial push with the full project configuration also listed the fields from Package 2 as added.

Based on the error above it looks like the sfdx cli is creating a MDAPI package.xml correctly listing the custom fields, but not including the old MDAPI CustomObject XML including the fields.

Has anyone else worked around this? Any suggestions for next steps to troubleshoot?

I want to keep our data model fields coupled to the domain that deals with them. This doesn't seem possible currently.

3

This is an unlisted known issue with sfdx. I created a git repository to reproduce the issue and reported it to SFDC in a case; https://github.com/JonnyPower/sfdx-push-bug-20190124

I received the following response on my case:

Our engineers are aware of this and are working to find a solution to fix it.

However we do not have an ETA on the fix yet. Currently the only workaround is what you have already mentioned; performing separate push for the different packages.

I asked for this to be reported as a known issue under Salesforce DX and am awaiting a further response.

|improve this answer|||||
0

Yes we have the same problem. I would say to use um package by repo, but we are using the same approach as you. The workaround you can use is:

Merge all the fields + custom labels in the default package.

    {
        "path": "default",
        "default": true
    },

I built a plugin to do it and you can use it.

(https://github.com/dieffrei/sfdx-guidion-plugin/blob/master/src/commands/guidion/build/fix.ts)

Another problem probably you are going to find is about the custom labels, the plugin solve this problem as well.

--- default ----- labels
----- objects

--- package1 ----- labels
----- objects

--- package2 ----- labels
----- objects

|improve this answer|||||

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.