Showing results for 
Search instead for 
Did you mean: 
Advocate I
Advocate I

Import/Export CDS Entity definition across environments ERROR!

The links above have got me almost all the way of through migrating an entity definiton from one environment to another. So far what I've done is go into Dynamics > Settings > Customizations > Customize the System, then select the entity I want and then export. It's hanging for a solid 5 minutes before throwing the error below.

  <ErrorDetails xmlns:d2p1="">
      <d2p1:value xmlns:d4p1="" i:type="d4p1:string">Plugin/Microsoft.Crm.WebServices.ExportXmlService</d2p1:value>
      <d2p1:value xmlns:d4p1="" i:type="d4p1:string">Microsoft.Crm.CrmException: An unexpected error occurred. ---> System.InvalidOperationException: The specified node cannot be inserted as the valid child of this node, because the specified node is the wrong type.
   at System.Xml.XmlNode.AppendChild(XmlNode newChild)
   at System.Xml.XmlNode.AppendChild(XmlNode newChild)
   at Microsoft.Crm.Tools.ImportExportPublish.SiteMapExportHandler.AppendAppModuleSiteMapXml(XmlDocument exportDocument, Guid siteMapId, String siteMapElementInnerXml)
   at Microsoft.Crm.Tools.ImportExportPublish.SiteMapExportHandler.AppendXml(XmlDocument exportDocument, Guid siteMapId, String siteMapElementInnerXml)
   at Microsoft.Crm.Tools.ImportExportPublish.SiteMapExportHandler.ExportItem(XmlDocument exportDocument, Guid siteMapId)
   at Microsoft.Crm.Tools.ImportExportPublish.AppModuleSiteMapHandler.ExportItem(XmlDocument exportDocument)
   at Microsoft.Crm.Tools.ImportExportPublish.ExportHandler.Export(XmlDocument XDoc)
   at Microsoft.Crm.Tools.ImportExportPublish.RootExportHandler.RunExport()
   at Microsoft.Crm.WebServices.ExportXmlService.ExportSolutionWithTargetVersion(String solutionName, Boolean managed, String targetVersion, Boolean exportAutoNumberingSettings, Boolean exportCalendarSettings, Boolean exportCustomizationSettings, Boolean exportEmailTrackingSettings, Boolean exportGeneralSettings, Boolean exportMarketingSettings, Boolean exportOutlookSynchronizationSettings, Boolean exportRelationshipRoles, Boolean exportIsvConfig, Boolean exportSales, Boolean exportExternalApplications, ExecutionContext context)
   --- End of inner exception stack trace ---
Solution Supplier
Solution Supplier

Based on the stack trace, this looks like the problem is a corrupt SiteMap (navigation structure). If your entity is included in any Areas (e.g. Sales, Settings), then the SiteMap will be included in the export.

There are a couple of different ways to resolve this:

  1. You could use the XrmToolbox tools, which have an option to reset the SiteMap. This would reset the whole SiteMap, so may not be viable if you have a lot of SiteMap customisations and no backup of them
  2. You could remove the entity from all Areas (the 'Areas that display this entity') check boxes on the entity properties (in the customer experience user interface). Save and publish the entity, then export

Helpful resources

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (1,566)