Form Lookup is not working in AX 7


I have created a form and used a String control there which is bound to a Data Field of a datasource table. I wish to populate the lookup with Names of all the Forms present in UtilElements table.

This is what I did:-

  1. Overridden the lookup method of the particular datafield (FormName in this case) of the associated form’s DataSource.
  2. From there I called a function and wrote the below code there:-

But the problem is no data is being populated in that lookup. Its coming blank.


I will like to mention here that this same piece of code works perfectly in AX 2012. Like the below image. Why its not working in AX 7? Is there a major change in AX 7 related to lookup? How to fix this issue and make my lookup work in AX 7?


I am new to AX 7 (I guess everyone here is…) But still if you manage to know the solution, plz share.


You’re unable to locate the problem because you’re dealing with too many things at once.

First of all, check whether the query returns anything. If it doesn’t, your problem isn’t related to lookup at all - we can safely ignore everything related to lookups and the debugging won’t require dealing with them.

Or the query is fine and you have a problem with the lookup. Then it doesn’t matter what kind of query you use.

So far it seems to be the former case. Please do your debugging to be sure.

I think that your debugging will show that UtilElements doesn’t contain any data. Unfortunately I don’t know yet how it’s populated in AX7.

Thanks Martin, you are spot on. The UtilElements Table is indeed blank. There is no data.

So there is no question of displaying anything in the lookup. I should have found this out myself rather than posting it in this forum beforehand.

Anyways, as you already stated you do not know about populating this UtilElements table, does anybody here know how to populate the UtilElemens table? Does it depend on company? Will changing company load the data?

In AX 2012, UtilElements is a view to the modelstore database, therefore it’s always populated. As AX7 doesn’t have any modelstore database, the same approach doesn’t make any sense. It would have to be populated by reading contents of XML files in modelstore storage (if it’s supported at all).

As the first thing, please try to recompile the whole application. It might populate this table.

Companies in AX OLTP database have nothing to do with AOT objects.

I tried recompiling the entire application followed by a DB sync, but still it didn’t populate the UtilElements table. Surely there is an alternative way to populate the table.

You were right Martin when you said, Companies have nothing to do with AOT objects. But I have seen earlier in AX 7 that, when default company was set to DAT, the Vendors and Customers table were all empty. Once I changed the company to USMF, those tables were all populated. It seems there is some demo data for specific customers.

If UtilElements table remain empty, it will block my work. Is there any way out? No resources available in net as well.

Yes, customers and vendors are stored in AX database and it makes sense to talk about them in a context of companies. But that’s not related to the current topic. Code and metadata, such as forms, are not stored in database at all and they have nothing to do with companies.

I’ve got a confirmation that UtilElements and related tables are not supported anymore. Let me explore the new approach; I’ll update this thread later.

I suggest you use MetadataSupport class. For example:

var forms = Microsoft.Dynamics.Ax.Xpp.MetadataSupport::FormNames();
while (forms.MoveNext())
    print forms.Current;

Thanks Martin for your quick thoughts.

Well I checked the code using MetadataSupport class and it returns the list of form names properly.

But as I stated I want to use a lookup in my form which will list down all the form names. How can I achieve a lookup using this MetadataSupport class? Is it possible t create a lookup without using a table?

And what are the alternative ways to achieve a lookup-like UI if for instance a SysTableLookup cannot be used?

Sorry, I thought you would know how to put the data into a table.

First create a table. It can be either temporary table or a persistent one, but I would prefer the latter. It means that you have to regenerate the content if you add a new form, but AX won’t have to search the metadata again for every request.

Add a field for form name. In the lookup for each form, fill the field and call insert().

Then use this table as the datasource of your lookup.

Thanks Martin. I know how to populate data into a table.

But I was not sure if that was the only way to populate the Form lookup. That is populate data in a table from MetadataSupport class and then use this table as the datasource of the lookup. A bit of complexities.

Anyways, it solved my purpose. Thanks.

Lookup form are based on tables, therefore you have to use a table. It was your own requirement to use a lookup, not mine.

If you, say, create a form with a list of form names, you can populate the list directly without any table.

But saving the data in a table will be much better for performance.