3 thoughts on “AX 7. Get information about table extension using Microsoft.Dynamics.Ax.Xpp.MetadataSupport

  1. AX Library December 27, 2019 / 5:58 am

    How to get extended fields for a particular model? E.g. if CompanyInfo has been extended in ModelA and ModelB then I just want to get the list of fields under ModelA.

    • Ievgen Miroshnikov January 2, 2020 / 9:09 pm

      You can always iterate through all extension and check their model, like:

      var axTableExtensions = Microsoft.Dynamics.Ax.Xpp.MetadataSupport::GetTableExtensionsForTable(tableStr(CaseCategoryHierarchyDetailStaging));
      System.Collections.IEnumerator axTableExtensionsEnumerator = axTableExtensions.GetEnumerator();

      while (axTableExtensionsEnumerator.moveNext())
      Microsoft.Dynamics.AX.Metadata.MetaModel.AxTableExtension axTableExtension = axTableExtensionsEnumerator.get_Current();
      info(strFmt(“Extension name %1”, axTableExtension.Name));
      var models = Microsoft.Dynamics.Ax.Xpp.MetadataSupport::GetModelsOfMetadataArtifact(axTableExtension.Name, axTableExtension.GetType());
      System.Collections.IEnumerator modelsEnumerator = models.GetEnumerator();
      while (modelsEnumerator.moveNext())
      Microsoft.Dynamics.AX.Metadata.MetaModel.ModelInfo modelInfo = modelsEnumerator.get_Current();

      info(strFmt(“Model %1”, modelInfo.Name));

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s