Just a simple tip here that Google didn’t turn up a quick answer on.
In 2012, many tables use the RecId field as the Primary Key. The ‘human readable’ value is then defined using an Index with the Alternate key property set to Yes.
When creating a lookup (dropdown) in this case, you probably need to get the RecId, but want the user to see the Alternate key displayed.
Joris has a great post on how this works when your lookup is on a table that has a foreign key relation to the lookup table. (http://daxmusings.codecrib.com/2011/07/ax-2012-recids-and-unitofwork-foreign.html)
In my case, I was looking to create a simple dialog form with an unbound field (DataSource and DataField properties not set).
My first attempt was to create an Int64Edit control and set the ExtendedDataType (EDT) property.
Of course, this results in this:
Overriding the lookup method can help with the values shown when the dropdown is displayed, but it doesn’t fix that the RecId is shown in the field.
The answer is a new type of control called Reference Group. (add it to your form just like any other type: right click, New Control, ReferenceGroup)
At first, the Reference Group will be empty, but when you set the ExtendedDataType property, a field is automatically added to the group. Below I’ve renamed the reference group and set the EDT property.
And the result is:
The underlying RecId can be referenced by setting AutoDeclaration to Yes and using value() method on the reference group control. In the example above, that would be ctrlPlanPeriodRefGroup.value().