One of the crucial concepts in Dynamics 365 for Operations are Data Entities… you use them for basically everything. Data entities is an abstraction on top of the regular database table which aggregates multiple table into one object.
Today I had a problem with an entity missing som the entity list. I this happens the solution is usually to refresh the list by going to System administration – Workspaces – Data management – Data import/export framework parameters and clicking Refresh entity list under Entity Settings.
That did not do the trick today so I had to dig deeper… and found this SQL script that clears the entity list:
-- This source code or script is freeware and is provided on an “as is” basis without warranties of any kind, -- whether express or implied, including without limitation warranties that the code is free of defect, -- fit for a particular purpose or non-infringing. The entire risk as to the quality and performance of -- the code is with the end user. -- Create backups of the tables first SELECT * INTO DMFEntity_backup FROM DMFEntity GO SELECT * INTO DMFTargetXML_backup FROM DMFTargetXML GO SELECT * INTO DMFTargetXMLToEntityMap_backup FROM DMFTargetXMLToEntityMap GO SELECT * INTO DMFTargetEntityHierarchy_backup FROM DMFTargetEntityHierarchy GO -- Truncate the tables TRUNCATE TABLE DMFENTITY GO TRUNCATE TABLE DMFTargetXML GO TRUNCATE TABLE DMFTargetXMLToEntityMap GO TRUNCATE TABLE DMFTargetEntityHierarchy GO
Then I go back to Data import/export framework parameters and run Refresh entity list.
That seem to do the trick
NOTE: this procedure has one slight down side and that you are also deleting all mappings for all entities. The (rather tedious) solution is to go into each entity and regenerate mappings… for all 2800+ entities… Wohoo…
Fortunately a smart person on Yammer wrote this script that regenerates all mappings for all entities in one run.