Creating a lookup to AOT objects
In the past we could use the table UtilElements to get a list of AOT objects. In 365 for Operations that is no longer possible as the table contains no data. Microsoft have provided us with a way of accessing the metadata of the AOT though. There are a number of methods under the class Microsoft.Dynamics.Ax.Xpp.MetadataSupport which provide us with a string enumerator for looping through elements. For example ReportNames will give us all the report names in the system. However if we want a lookup on a control we will need to use a table. For this we can create a TMP table which we will populate. I have created the InMemory table with a single field to store the report name. I then have created the below method to populate the table. I loop through the results returned by using Microsoft.Dynamics.Ax.Xpp.MetadataSupport::ReportNames() and insert a record in for each:
All I need to do now is override the lookup method and create a lookup for it: