I am trying to push a managed extension package to a scratch org but am running into some issues. The issues seem to be stemmed around some custom objects that are owned by the package that is being extended. I have added the "extension" fields and can see that the objects are being added to the extension package but it is still erroring. Any suggestions?
-
Did you install the base package first?– sfdcfox ♦Commented Aug 16, 2017 at 3:03
-
@sfdcfox Onto the scratch org?– Zack WaltonCommented Aug 16, 2017 at 3:04
-
Yes, I would expect you have to follow the normal (previous) development process for creating extensions. Install all prior packages and dependencies before trying to deploy your code.– sfdcfox ♦Commented Aug 16, 2017 at 3:07
-
That would make sense. I have tried to follow this which I realize you answered with no luck. I get an error when trying to deploy the managed package– Zack WaltonCommented Aug 16, 2017 at 3:09
-
Well, unfortunately, I don't (currently) have DX, unless you want to invite me to join your party 😉. We're going to be doing this in like a week or three, but I can't do anything until the boss says. I'm dying to play with it.– sfdcfox ♦Commented Aug 16, 2017 at 3:11
1 Answer
In case anyone else ends up here, I hit the same issue today and spent a long time trying different approaches until I found one this one that seems to have worked.
I created a scratch org with the namespace for the extension package, and added the package it extends i.e the master package. That master package contains a custom object and some fields which I use in my child package, and I also add some fields to it in my child package.
I then converted the metadata of the extension package into the DX format, and added the code to my DX project for the extension package. Note - although I could see the fields and reference to the custom object in my master package in the DX source, if I tried to push at this point it failed.
So I then edited the custom object from my master package in my new scratch org (I enabled Track Activities), and did a force source pull with -f param to force the metadata to come down. At that point, DX not only retrieved all the fields on the the custom object into my source, it also updated the metadata for the object definition. At this point, I was then able to push the metadata to my scratch org.
Looking at the metadata, I suspect I could just copy the metadata definition from the DX project for that object from my master package and it would work (it looks the same at first glance), so I think this just an issue with the way the DX metadata is retrieving objects from the packaging org when your package has a dependency on another package.
One other thing I noted was that I have custom fields on Account and other standard objects, but in those cases there is no object definition in the directory for that object so it seems to be something specific to referencing a custom object in a separate managed package.