AX 2012 Metadata – issue with Maps

by | Updated August 15, 2016 | Development, Dynamics AX

AX 2012 Metadata – corruption in model metadata

In AX 2012 Metadata, we have come across a scenario in which a model’s metadata becomes corrupted. The symptom presents as objects that suddenly won’t compile, throwing errors such as…

The map does not exist.

Operand types are not compatible with the operator.

AX 2012 Metadata

Upon investigation, code is found which seems to indicate that the referenced object does not exist.

 

public DimensionDefault parmDefaultDimension()

{

   return vendInvoiceMap.VendInvoiceMap::defaultDimension();

}

 AX 2012 Metadata – example of Map issue

In one specific case, we found that the vendInvoiceMap object did not exist as a Map. Instead, it was in the AOT as a Table, causing all of the objects referencing the Map to throw errors during compile.

It is not clear what causes the corruption in the metadata, since Microsoft has not been able to reproduce the issue. However, they have provided a sql script which will allow for updating the bad metadata from a database in which the metadata is not corrupted.

For the purpose of this example, the vendInvoiceMap object in the MicrosoftDynamicsAX_model database is the one we are trying to fix. We know that we have a good copy in MicrosoftDynamicsAXTest_model.

Note: Backup the model database in the environment where the corruption exists before executing the following script.

 

 

— This Select checks for the existence of the affected object in the corrupted environment

 

SELECT m.ElementType, m.Name, m.AxId, md.LayerId, manifest.DisplayName, md.Properties as Metadata

               FROM MicrosoftDynamicsAX_model.[dbo].ModelElement AS m

               INNER JOIN MicrosoftDynamicsAX_model.[dbo].ModelElementData AS md

                              ON m.ElementHandle = md.ElementHandle

               INNER JOIN MicrosoftDynamicsAX_model.[dbo].ModelManifest AS manifest

                              ON md.ModelId = manifest.ModelId

                AND m.ElementType = 44 AND m.Name = ‘vendInvoiceMap’

 

 

— This Select checks for the existence of the affected object in the clean environment

 

SELECT m.ElementType, m.Name, m.AxId, md.LayerId, manifest.DisplayName, md.Properties as Metadata

               FROM MicrosoftDynamicsAXTest_model.[dbo].ModelElement AS m

               INNER JOIN MicrosoftDynamicsAXTest_model.[dbo].ModelElementData AS md

                              ON m.ElementHandle = md.ElementHandle

               INNER JOIN MicrosoftDynamicsAXTest_model.[dbo].ModelManifest AS manifest

                              ON md.ModelId = manifest.ModelId

                AND m.ElementType = 44 AND m.Name = ‘vendInvoiceMap’

                

— Replaces corrupted metadata from clean environment

 

Update md Set md.Properties = md_base.Properties

FROM MicrosoftDynamicsAX_model.[dbo].ModelElement AS m

               INNER JOIN MicrosoftDynamicsAX_model.[dbo].ModelElementData AS md

                              ON m.ElementHandle = md.ElementHandle

               INNER JOIN MicrosoftDynamicsAXTest_model.[dbo].ModelElement AS m_base

                              ON m.ElementType = m_base.ElementType AND m.Name = m_base.Name

               INNER JOIN MicrosoftDynamicsAXTest_model.[dbo].ModelElementData AS md_base

                              ON m_base.ElementHandle = md_base.ElementHandle

AND m_base.ElementType = 44 AND m_base.Name = ‘vendInvoiceMap’ AND md_base.LayerId = 0

 

After executing this script, restart the AOS so that the object changes are picked up. In the AOT, expand Maps and you should be able to locate vendInvoiceMap. If so, recompile all affected objects. They should now compile cleanly. AX 2012 Metadata

Related Posts

  • The Safari browser is now supported natively on Dynamics AX 2012 R2 as well as being supported on Dynamics AX RTM with a hotfix.  Taken from the updated System Requirements…

  • I put together some certification information on the requirements for Microsoft Dynamics AX 2012 and a proposed training roadmap to get to each of the core certifications.  Rather than have this…

  • With the announcement of the release of Microsoft Dynamics AX 2012 R2, Microsoft released an updated system requirements document for AX 2012: http://www.microsoft.com/en-us/download/details.aspx?id=11094.  Windows 2012 Server is now supported, but…

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Upcoming Events

october

07oct12:00 pm1:00 pmThe Three Paths to Business Central from Dynamics GP

08oct11:00 am12:00 pmConfab with Stoneridge - Livestream - The Vision and Strategy of Microsoft Business Systems

14oct10:00 am10:30 amThe Modern Manufacturer - Managing Complex Cost Modeling

14oct12:00 pm12:30 pmGenerating Custom Inspection or Process Forms

19octAll Day22Stoneridge Connect Fall 2020

22oct11:00 am12:00 pmConfab with Stoneridge - Livestream - Stoneridge Connect Recap

28oct10:00 am10:30 amThe Modern Manufacturer - Engineering Change Management: Introduction of NEW Functionality for Manufacturers Using Dynamics 365

november

18nov10:00 am10:30 amThe Modern Manufacturer - Tears and Trauma of MRP

About Stoneridge
Stoneridge Software is a unique Microsoft Gold Partner, with emphasis on partner. With specialties in Microsoft Dynamics 365, Microsoft Dynamics AX, Microsoft Dynamics NAV, Microsoft Dynamics GP and Microsoft Dynamics CRM, we focus on attracting the most knowledgeable experts in the field to our team, and prioritize delivering stellar solutions with maximum impact for your business. At Stoneridge, we are deeply committed to your results. Each engagement is met with a dedicated team, ready to provide thorough, tailored, and expert service. Based in Minnesota, we intentionally “step into your shoes,” wherever you are. We focus on what you care about, and develop trusting, long-term relationships with our clients.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!

X