AX 2012 Metadata – issue with Maps

By Laura Lake | February 10, 2014

Ax 2012 metadata – issue with maps

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..ModelElement AS m

               INNER JOIN MicrosoftDynamicsAX_model..ModelElementData AS md

                              ON m.ElementHandle = md.ElementHandle

               INNER JOIN MicrosoftDynamicsAX_model..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..ModelElement AS m

               INNER JOIN MicrosoftDynamicsAXTest_model..ModelElementData AS md

                              ON m.ElementHandle = md.ElementHandle

               INNER JOIN MicrosoftDynamicsAXTest_model..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..ModelElement AS m

               INNER JOIN MicrosoftDynamicsAX_model..ModelElementData AS md

                              ON m.ElementHandle = md.ElementHandle

               INNER JOIN MicrosoftDynamicsAXTest_model..ModelElement AS m_base

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

               INNER JOIN MicrosoftDynamicsAXTest_model..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

Recommended Reading:

Managing Your Business Through Uncertain Times Using Dynamics 365 Finance and Operations

  Dynamics 365 Finance and Operations (F&O) can help you make informed decisions on how to move your business forward. […]

Read the Article
5.13.22 Power Platform

Using Power BI Object Level Security

  The following article will demonstrate how to use Power BI Object Level Security to disable column data based on […]

Read the Article
5.12.22 Dynamics CRM

How to Use the Stoneridge Support Portal

Stoneridge Software’s support portal is an intuitive and useful function that makes it easy for you to access resources to […]

Read the Article
5.6.22 Dynamics GP

Dynamics GP Transaction Removal: Purchase Orders

  Are you having performance issues with Purchase Orders?  Do you find that there are old Purchase Orders on your […]

Read the Article
5.5.22 Dynamics GP

The Real Story about the Long-Term Future of Dynamics GP Support

I’ve seen a number of people put forward comment that Dynamics GP is going away and you have to get […]

Read the Article

New Features in Dynamics 365 Business Central 2022 Wave 1 Release – Financial Enhancements

The Dynamics 365 Businses Central 2022 Wave 1 Release has a lot of new and exciting features to help your […]

Read the Article
4.29.22 Dynamics GP

Dynamics GP Transaction Removals: Bank Reconciliation

  This is part 2 of a 3 part series on Dynamics GP Transaction Removals. These quick tips will hopefully […]

Read the Article
4.28.22 Dynamics GP

Uncommonly Used Features – Integrate Purchasing and Payables to Fixed Assets in Dynamics GP

Being able to integrate Purchasing and Payables to Fixed Assets in Dynamics GP will help you create visibility for your […]

Read the Article

New Features in the Dynamics 365 Business Central 2022 Wave 1 Release – Ease-of-Use Features

  There are many new features in the Dynamics 365 Business Central 2022 Wave 1 Release to get excited about! […]

Read the Article

Start the Conversation

It’s our mission to help clients win. We’d love to talk to you about the right business solutions to help you achieve your goals.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!

X