Microsoft Dynamics AX Support

This blog contains posts by the Microsoft Dynamics AX Support Teams Worldwide

AX 2012, a TableMap object turns to be a Table

 

Issue description:

 

We have seen some scenarios while deploying Models/ModelStore among multi environments, 

that a TableMap object turns to be a Table.

Cause:

Unknown, no consistent repro pattern has been spotted

Resolution suggestion:

We take e.g. that the affected object is the ‘CustVendInvoiceTrans’ table map.

Run the following SQL script in order to correct the object type:

— Assumption: Script works against dev model store

— Assumption: Clean baseline model store is named: axdbdev_model_id_baseline (can be replaced by own naming)

 

— Check existence affect object in dev environment 

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

FROM [dbo].ModelElement AS m

INNER JOIN [dbo].ModelElementData AS md

ON m.ElementHandle = md.ElementHandle

INNER JOIN [dbo].ModelManifest AS manifest

ON md.ModelId = manifest.ModelId

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

 

— Check existence affect object in baseline environment

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

FROM axdbdev_model_id_baseline.[dbo].ModelElement AS m

INNER JOIN axdbdev_model_id_baseline.[dbo].ModelElementData AS md

ON m.ElementHandle = md.ElementHandle

INNER JOIN axdbdev_model_id_baseline.[dbo].ModelManifest AS manifest

ON md.ModelId = manifest.ModelId

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

 

— Replace corrupted metadata on dev environment from baseline environment 

Update md Set md.Properties = md_base.Properties

FROM [dbo].ModelElement AS m

INNER JOIN [dbo].ModelElementData AS md

ON m.ElementHandle = md.ElementHandle

INNER JOIN axdbdev_model_id_baseline.[dbo].ModelElement AS m_base

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

INNER JOIN axdbdev_model_id_baseline.[dbo].ModelElementData AS md_base

ON m_base.ElementHandle = md_base.ElementHandle

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