cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DroningOn
Advocate I
Advocate I

Import/Export CDS Entity definition across environments ERROR!

https://docs.microsoft.com/en-us/dynamics365/customer-engagement/customize/export-solution

https://docs.microsoft.com/en-us/power-platform/admin/environment-and-tenant-migration

https://powerusers.microsoft.com/t5/General-Discussion/Export-Import-CDS-Entities-across-environment...

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.

<ErrorCode>-2147220970</ErrorCode>
  <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
    <KeyValuePairOfstringanyType>
      <d2p1:key>ApiExceptionSourceKey</d2p1:key>
      <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">Plugin/Microsoft.Crm.WebServices.ExportXmlService</d2p1:value>
    </KeyValuePairOfstringanyType>
    <KeyValuePairOfstringanyType>
      <d2p1:key>ApiOriginalExceptionKey</d2p1:key>
      <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" 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 ---
1 REPLY 1
DavidJennaway
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

Announcements
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)