Create Details master form with AOT Tables and fields


I need to create a Details Master form showing 1) a list box with list of tables from AOT and 2) a grid showing the related fields on the selected table name (from list box). Normally the datasource would be a table but here the data comes from the AOT.

I found some code that utilize the SysModelElement object, but the result is a map, and cannot be used as datasource for the form

Thanks in advance for your help!

SysModelElement is a system table, not a map, as far as I know. But it used to be used only in AX 2012 and it’s empty in D365FO, so it’s not going to help.

You seem to think that you can’t use tables as datasource if the data isn’t already in tables, but you’re forgetting about temporary tables. You can take data provided by the metadata API, put it into temporary tables and use these temporary tables in form (almost) as usual.

Hi Martin,

So i was able to list the tablenames by using the API. But I still don’t know how to get at the fieldnames for each table

public static void main(Args _args)
MyTableList htl;
var tabl = Microsoft.Dynamics.Ax.Xpp.MetadataSupport::TableNames();

while (tabl.MoveNext()) {
htl.TableName= tabl.Current;

This little example should help you:

using Microsoft.Dynamics.AX.Metadata.MetaModel;

AxTable axTable = Microsoft.Dynamics.Ax.Xpp.MetadataSupport::GetTable('CompanyInfo');
var fieldEnumerator = axTable.Fields.GetEnumerator();
while (fieldEnumerator.MoveNext())
    AxTableField field = fieldEnumerator.Current;

You have been very helpful. Thank you!