Try Microsoft Edge
A fast and secure browser that's designed for Windows 10
The post Using Multi-Select Lookup Control in Microsoft Dynamics AX 2012 appeared first on Dynamics 101.
Lookups are used to select values for a control in Microsoft Dynamics AX. The values can be records from a reference table or from multiple data sources in Microsoft Dynamics AX.
The lookup form is opened whenever the lookup button is pressed by a user on any field in Microsoft Dynamics AX. There are multiple methods to create a lookup form. This tutorial will discuss a method to create a lookup form in which multiple values can be selected for a single control.
As part of this tutorial, the user will be able to select multiple customers from a single lookup
Query query = new Query();
//creating query to show customer account and customer name
//the query must contain only those fields that should be visible on the lookup
qbds = query.addDataSource(tableNum(CustTable));
qbds = qbds.addDataSource(tableNum(DirPartyTable));
//assigning control and query to the class
msCtrlCust = SysLookupMultiSelectCtrl::constructWithQuery(element, MultiLookup, query);
container values = msCtrlCust.get(); // get the rec Ids of the Cust table. To get the display value, use the getSelectedFieldValues method
//loop through the container and show the selected Ids in the info log
for (i = 1; i <= conLen(values);i++)
Note: To remove the selected record(s), they need to be unchecked on the lookup. The Customers field will become non-editable when associated with the multi-select lookup control and hence, no change can be made on the field