I'm trying to migrate to sfdx, but right now just in the exploratory phase. The package.xml I'm working from is essentially a full org metadata pull that was generated via MavensMate, and I configured it to include managed package data so that I could have managed objects as well as custom fields on managed objects.

What this means though is that all managed metadata is pulled down. I'd prefer to be thorough rather than spend a ton of time pruning and crafting my package.xml, so this seemed like a fine solution while I was on Mavensmate.

Moving to SFDX, however, I have started to run into issues with converting the managed metadata to SFDX format, but these issues are all related to managed metadata in particular metadata types. The types are:

  • Documents
  • Reports
  • Dashboards
  • Emails

If there is any managed metadata in any of those folders, I get an error that says:

ERROR: Unexpected file found in package directory: [PROJECT_LOC]\mdapi\dashboards\[MANAGED_PACKAGE_FILE]-meta.xml

Removing the managed metadata from those packages allows the convert process to succeed. However, this just leads me to many more questions about how to work with Managed Packages in SFDX.

First, are these managed metadata types unsupported?

Second, how do scratch orgs work when I have installed customizations to managed metadata?

I know you have to install managed packages into scratch orgs after you create the scratch org, but it seems that Managed Custom Object metadata is supported in force:mpapi:convert... Is managed metadata in an sfdx package left out of the scratch org creation? How does the scratch org understand what to do with managed custom objects with my custom fields before the managed package is installed?

If someone could walk me through this practical example and either how/why it works, or where it will fail, I'd appreciate it:

My production org subscribes to a managed package with a namespace Vendor which comes with the custom object Vendor__Custom_Obj__c.

I customize the object to add a field so that we have Vendor__Custom_Obj__c.MyOrgField__c.

I want to spin up a scratch org that includes Vendor__Custom_Obj__c.MyOrgField__c, so I pull Vendor__Custom_Obj__c with all fields in my package.xml and run force:mdapi:convert to put it in my default package.

My scratch org is created using a script similar to this approach: https://salesforce.stackexchange.com/a/199151/48117

My scratch org should be created and the managed package should be installed. When does Vendor__Custom_Obj__c get installed, and when does MyOrgField__c get added to it? Does this workflow break down?


You must log in to answer this question.

Browse other questions tagged .