AX 2012 Reference Group For Employee Name

Hello everyone!  I just completed creating a reference group in AX to be able to show a list of employees, choose one, and then save that employee to a table.  I didn’t know how to do this before today so I did a lot of searching on the web and found a bunch of different blogs and posts but I didn’t find any of them on creating it for an employee list so I wanted to blog about how I did that.

In my example, I wanted to add a new section under Case Management – Parameters, but really, it doesn’t matter where you want to do this.  The process would be the same.

When I was searching how to create a reference group, I did read that you can only create one for RecId of a table, but I didn’t understand how to do that exactly.  Hopefully this step-by-step will be helpful to those of you who ran into the same issue as me.

Because in this example, I wanted to get a user’s personnelnumber and name in a list and record which employee I chose, I needed to get this information from the HCMWorker table.  But to create a reference group, you need to link your new field (where you will record which employee you chose) to the RecID of HCMWorker.  I started by creating a new Int64 Extended Data Type (EDT) that extends the EDT HCMWorkerRecId.

Right-click on Extended Data Types, choose New – Int64

RG Step 1 200x300 AX 2012 Reference Group For Employee Name

Name the EDT something appropriate and in the Extends drop down list, choose HCMWorkerRecId

RG Step 2 177x300 AX 2012 Reference Group For Employee Name

Now in the table that you want to save your employee, create a new field by right-clicking on the Fields list and choose New – Int64

RG Step 3 300x244 AX 2012 Reference Group For Employee Name

Name it something appropriate and change the ExtendedDataType property to the EDT you just created

RG Step 4 192x300 AX 2012 Reference Group For Employee Name

When you do that, it will prompt you if you want to add the Foreign Key relation.  You could say no and create yourself but it’s easier to just say Yes which is what we will do here

RG Step 5 300x103 AX 2012 Reference Group For Employee Name

Now a relation has been created to the HCMWorker table

RG Step 6 300x129 AX 2012 Reference Group For Employee NameRG Step 6 2 300x129 AX 2012 Reference Group For Employee Name

Next you want to make sure your table is part of the data sources of the form you are working with.  Drag your field from the Data Sources of the form to the form’s Grid

RG Step 7 231x300 AX 2012 Reference Group For Employee Name

You will notice it is automatically made a reference group.  Right now if you open your form, you should see your field as a drop down and when you click on it, you’ll get a list of employees.  When you choose one, you will see their RecId which isn’t ideal.  If you change the ReplacementFieldGroup property of your field to Person, then you will be able to see the employee’s name instead.

RG Step 8 300x227 AX 2012 Reference Group For Employee Name

Hopefully this helps any one who was having the same needs/issues as me!

CategoriesAX