The Infolog

A blog of Dynamics AX development tips and tricks

Skip to: Content | Sidebar | Footer

Creating a lookup to a field ID

5 December, 2016 (21:45) | Dynamics AX | By: Howard Webb

Sometimes we might want to allow the end user to select a field from a table within a form, for example if we are parameterizing the mapping values. To do with we will need the following items:


  • A field to hold the field ID (EDT FieldID)
  • A edit method on the form datasource
  • A string control on our form (EDT FieldLabel)
  • A lookup method on the form control


Firstly we add the field ID to the table (there is no need to make that visible) . That should be easy enough to do



On to our lookup. We will be using the class SysTableFieldLookup and just like a normal lookup we will create a query, however we only need the datasource in this instance, which should be the table the fields are on. We will need to return our lookup class after the lookup is performed as we will need to access it later to get the selected field. Once done it should look as follows



We will need a new global variable on the form of type SysTableFieldLookup

Next we will create the edit method.




You can see that if the control is set we pull the record from the lookup class and get the field ID for a table field from it.  Now its time to create our form control and point it at the edit method. With that done the last step is to override the lookup method to call ours and populate the global variable:




With that done you should now get a lookup on your form with the field label and help text



Print Friendly, PDF & Email