Map Values from Lists using AX 2012 SysListPanelRelationTableCallback

by | Updated August 15, 2016 | Development, Dynamics AX

Dynamics Ax 2012 contains a class called SysListPanelRelationTableCallback that helps you build a UI to associate values from two lists. This is used by the User Groups (SysUserGroupInfo) and Server Configuration (SysServerConfig) forms among others. For purposes of this example, assume we are working on a feature that limits the valid currencies for any given country. We will build a form that allows us to associate a list of currencies with each country.

First, we need to create a table to hold the mappings. We’ll call this table CountryCurrency to indicate that it is an association table between Countries and Currencies. This table will need to contain the primary key fields from both tables. Right click the Relations node on the CountryCurrency table and choose “New Relation”.  Enter LogisticsAddressCountryRegion in the Table property. Now right click the relation and choose “New/ForeignKey/PrimaryKey based” to create a foreign key relationship to the table. This will add the necessary fields to our table. Now do the same for the Currency table. Finally, create an alternate key index on the CountryCurrency table containing both of these fields.

AOT Data Dictionary Table

Now we need to create a form that allows the user to create the map. In the AOT, right-click on the Forms node and choose “New Form from template/SimpleListDetails.”  This will give us a form with a little head start. Rename the form CountryCurrency to match the table. Create a Data Source for the LogisticsAddressCountryRegion table and bind it to the grid (Design/Body/GridContainer/Grid).  Add string controls bound to the CountryRegionId field and displayName display method to the grid. Then find the DetailsTab tab control and change the Style property to “Tabs” and set ShowTabs to “No.” If you run the form now you should have something that looks like this.

Country and Description

Now we will add the SysListPanelRelationTableCallback class to handle the rest of the UI.

Add a member variable named listPanel to the form.

Override the init method on the form so we can setup the tables that will be used in the mapping.

Now we will implement the getRightData method to populate the right data list.

If we were to re-write this select statement using the values from the form’s init method, it would look something like this.

The only thing left to do is tell the SysListPanelRelationTableCallback class when our “Left” value has changed so it can update itself.  To do this we will override the LogisticsAddressCountryRegion data source’s active method like this.

Now when you run the form you should see something like this.

Allowed Currencies

To map a currency to the current country, select it and press the “<” button.

Allowed Currencies

If you open your CountryCurrency table with the Table browser you will see it contains the 2 association records mapping the AED and AMD currencies with Aruba. The SysListPanelRelationTableCallback class is handling the mapping table records for us. If we map a value it will insert it into the map, and if we un-map a value, it will remove it from the map.

Table Browser


Related Posts

  • In AX 2012 you can set the value for a specific dimension using code similar to what is below. DimensionAttributeValue         dimAttrValue; DimensionAttribute              dimAttr; DimensionAttributeValueSetStorage davss; RecId                defaultDimension; davss = DimensionAttributeValueSetStorage::find(this.DefaultDimension); dimAttr…

  • **Updated 11/20/2013** There are quite a few important keyboard shortcuts that can really save some time when entering data and moving around in AX 2012.  One in particular - hitting…

  • The much anticipated release of AX 2012 R2 has been announced. Here are the new features that have my attention. I'll be sure to post some detail, as I explore…


Submit a Comment

Your email address will not be published. Required fields are marked *

Upcoming Events


06oct10:00 am10:30 amPreview of D365 Business Central Fall Release Features and Functionality

06oct12:00 pm12:30 pmInsider's Guide to New Features Available in the Fall Release of D365 Finance and Supply Chain

07oct11:00 am12:00 pmConfab LIVE with Stoneridge - Dataverse and Dynamics in Review – Let’s Get Technical

13oct12:00 pm12:30 pmWave 2 Release – What’s Coming for Dynamics 365 Sales and Customer Service

21oct11:00 am12:00 pmConfab LIVE with Stoneridge - Dataverse and Dynamics in Review – Let’s Get Functional

26oct(oct 26)9:00 am28(oct 28)5:00 pmStoneridge Connect Leadership and Community Conference


04nov11:00 am12:00 pmConfab LIVE with Stoneridge - Challenging the Development Paradigm

About Stoneridge
Stoneridge Software is a unique Microsoft Gold Partner, with emphasis on partner. With specialties in Microsoft Dynamics 365, Microsoft Dynamics AX, Microsoft Dynamics NAV, Microsoft Dynamics GP and Microsoft Dynamics CRM, we focus on attracting the most knowledgeable experts in the field to our team, and prioritize delivering stellar solutions with maximum impact for your business. At Stoneridge, we are deeply committed to your results. Each engagement is met with a dedicated team, ready to provide thorough, tailored, and expert service. Based in Minnesota, we intentionally “step into your shoes,” wherever you are. We focus on what you care about, and develop trusting, long-term relationships with our clients.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!