cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper I
Helper 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
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
secondImage

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

Users online (16,869)