Standard automatic lookups are widely used across the system, but sometimes it is required to show different fields from different data sources, apply various static or dynamics ranges, and so on. It is not possible to achieve such results by modifying or creating table relations, changing TitleField1 or TitleField2 properties, or editing the AutoLookup group. But Dynamics AX allows creating custom lookups either using AOT forms or dynamically generating them from X++ code. This recipe will demonstrate the latter option, which uses the SysTableLookup
application class to build a runtime lookup from X++ code.
In standard Dynamics AX, every customer account can be assigned to a vendor account and vice versa. In this example, we will modify the Vendor account lookup on the Customer Details form to allow users to select only vendors that use the same currency as the customer.