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
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.
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;
info(field.Name);
}