Replacement groups in AX 2012

AX 2012 introduced a new type of form control called “Replacement group”. It’s very handy, nevertheless quite a few developers still don’t know about it or are not sure how to use it effectively.

This post is not going to details; the intention is rather to show something simple, though still from end to end.

Let’s say that we want to create a form showing released products. We create a form with InventTable as the data source and with a grid.

We’re especially interested in the Product field, so we drag it from the data source and drop it to the grid.


Notice that the type of the control is ReferenceGroup – we’ll talk about it very soon.

Without changing anything, we can run the form; it successfully displays product numbers:

Let’s say that users insist on working with product names instead of product codes. Maybe they should have used a better convention for product codes, but that’s another topic. Now we have meet the request.

What should we do? Providing an edit method that would display names and find IDs from names specified by users? No, it’s much simpler with reference groups. Open properties of the reference group and change the value of ReplacementFieldGroup property from AutoIdentification to ProductInformation:


Save the form and open it again – it now shows product names. It’s that simple!


If the product was editable (which is not normally the case in InventTable), you would also get a lookup and would be able to select (or type) product names:


You could also override the lookup, if you don’t like the default one.

Now we should look more closely at how it works.

First of all, look at the Product field in InventTable. Its base type is Int64 and extended data type is EcoResProductRecId. Properties of the EDT shows that ReferenceTable = EcoResProduct, therefore the Product field contains record IDs of EcoResProduct table.

If we used the Int64Edit control to display the Product field, we would see just numbers, which wouldn’t be very useful.


That’s why we have Reference group controls. The reference group in our form is bound to the Product field (set in ReferenceField property), so that’s what gets saved to database. But we don’t display it to users – instead of that, we use a replacement field group. Field groups are defined on tables in AOT – here we can see the groups of EcoResProduct that we used in our example:


AX looks at the field (or even fields) contained in the field group and displays them instead of the record ID. If you change a value of the replacement field, AX finds the corresponding RecId and put it to the underlying field.

As you can see, reference groups allow you to change fields displayed to users by a simple property change. Also notice that it has zero effect to data stored in database – it still refers to a record ID.

There is one last thing I would like to mention, because it often confuses people. You may have a reference group for a worker showing the worker name (e.g. the Sales responsible person in Sales order form). The control uses the AutoIdentification field group of the HcmWorker table. The group contains a single field, Person, which is a RecId of DirPerson table. AutoIdentification group on DirPerson is empty, so where the name comes from? The trick is that DirPerson table inherits from DirPartyTable, which contains the Name field in its AutoIdentification group. AX deals with all this complexity for you.


  1. Hi Martin,

    Its regarding the reference group. Is it possible to store CustTable.CustAccount and display the Names of customer that is DirPartyTable.Name using reference group?

    • Did you find any solution for this scenario? I have the same scenario. Please help me fix this.

  2. I have a question if someone can answer.
    I dragged and dropped the WorkerSalesResponsible field from the datasource (SalesTable) to grid but for some reason the only top row shows the name rest of the rows are blank for WorkerSalesResponsible field. The form is SalesLineOpenOrder in AOT.

    • It doesn’t seem to be related to reference groups. Ensure yourself that you have data in the field and that your data sources are set properly. If you need more help, ask a question in one of AX community forums.

  3. Hello, there is a wrong information on text: Field groups are defined on tables in AOT – here we can see the groups of InventTable that we used in our example…..

    The wrong information is InventTable, the table that is shown is EcoResProduct.

  4. Hi Martin,

    First of all very useful post.
    I implemented the same and worked perfectly.
    But while testing I realized that there is always an initial value to begin with.
    I was using the reference group for Location( Table: LogisticsPostalAddress)
    Any thoughts on that ?
    I was doing this with two reference group control, the one above this was for Party and then based on that party I was populating the below Location addresses ( I did override the lookup ) and that was happening as well.

  5. Hi Martin,
    first thank you for you posting.
    How can i use the concept of reference Group when in the table exists an relation.
    For example the table intrastatParameters and IntrastatTransportMode.
    I want the “IntrastatTransportMode.Description” on the IntrastatParameter table.

    Best Regards,

    • Orhan, the tables are connected through a string key. Such a type can’t be used as a reference field. You would have to re-implement the relation, but you should think twice if you want to do it with standard AX tables.

  6. Hi everyone
    I have problem with replacement group, because I wish to display fields form ValidTimestate table – when I have relation to present (AsOfDate) record everything works fine but If it is not present record relacement group display blank fields.
    Is there any workaround to display record beside validTimestate.

    Kind Regards.

  7. Hi Martin,
    Have you ever had to display the translation of a field in a reference group?

    I have a table with a field (not mandatory) that represents the Delivery Mode: MyTable.DlvMode = DlvMode.RecId.
    I would like to display on MyForm the description in user’s language.
    I’ve tryed the next solution but it does not work:
    1. I’ve created a display method on the DlvMode table that returns the related translation
    2. I’ve created a field group on the DlvMode table contains the display method
    3. I’ve added a reference group on MyForm with:
    a. Datasource = MyTable
    b. ReferenceField = DlvMode
    c. ReplacementFieldGroup = the field group created before with the display method

    Any suggestions?


    • “I would like to MANAGE on MyForm this field using the description in user’s language.”

      It’s not just about to display a value..

  8. Is there a way to get the reference groups working on ListPage -> Grid ?

    • It is – simply right-click the grid control in AOT, choose New Control > ReferenceGroup and set its properties.

  9. Hi Martin,

    I have a more complex situation and I hope you have an answer for me. We have some lookupReference that we need to customize because we have to apply some range in some situations. In those lookup we have some fields that are also RefRecId to another table. The AutoIdentification works well and the informations display in the lookup is good. But we have to sort on these fields. To do it, we have to add the referenced tables to the query and add the sortfield.

    The problem is that if we put the useLookupValue to False, our sorting works great, but as soon as we put it to True, the sort doesn’t work anymore.

    I read somewhere that maybe we can use a temptable or a view to simulate our data in only one table, but it’s a lot of modification in the AOT since we have many lookups that we have this pattern. For now, we set useLookupValue to false, but it’s not really userfriendly.

    I hope I explain my point clearly and someone have a wonderfull solution.


  10. Hi,
    Based on SalesTable form. I created custom form to edit address with validTimeStateUpdate = correction instead of creating new as a copy of button for new address.

    when I update address, I cannot refresh reference value displayed in SalesTable Address field with any command like refresh, reread, research…any idea?

Comments are closed.