I'm trying to convert some code I'm writing in my sandbox into an SFDX project. The one complication is that my code references custom fields and objects that are part of a managed package.
Per the SFDX docs, I created an unmanaged package in the package manager in my sandbox, and added my apex class. All the referenced fields and objects were automatically pulled in as components as well:
Note that there are three custom objects from a managed package included there:
- Loan
- Deposit
- Entity Involvement
However, when I look at the unzipped package retrieved via sfdx force:mdapi:retrieve
, there appears to only be metadata for one of those objects, along with the standard account object (which we've relabeled 'Relationship'):
This naturally follows through to the next step, when I convert the retrieved package with sfdx force:mdapi:convert
to my SFDX project. Finally, when I try to push my SFDX package to a new scratch org, I get the following errors:
I'm not sure why there's an error about Entity 'LLC_BI__Loan__c' not found
, since that's the one object that was retrieved. But my concern is mainly with not being able to pull the full set of components I need to make an SFDX project, using the method SF themselves prescribe here: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_retrieve_unman_pack.htm
Best Answer
You can :
generate the package.xml of your whole sandbox using https://packagebuilder.herokuapp.com/
use force:mdapi:retrieve with the generated package.xml in a temp folder
copy paste the missing metadatas into your unmanaged package retrieve folder
Then, when you will need to deploy to another org, if you don't need to deploy the whole SFDX project in an org (Profiles etc ...) , but only the content of a package.xml file, you can use command sfdx essentials:filter-metadatas of sfdx plugin https://github.com/nvuillam/sfdx-essentials