How to Create Multi Select Lookup in Microsoft Dynamics AX

By Nicole Gentz | April 15, 2015

Main AccountDo you need a lookup that allows you to select multiple items in Microsoft Dynamics AX? Do you need to store the multiple values in the database? Check out the following example using multi select lookup that allows you to select multiple main accounts in AX.

Use the following steps to create Multi Select Lookup in Dynamics AX:

1.  Create an AOT query for the lookup.


2. Create the control on the form, set the auto declaration property to yes


3. In the Modified method of the control:

public boolean modified()
boolean ret;

ret = super();

SalesParameters.SSI_MainAccountId = SSI_MultisitePostingSales_Invoice_SSI_MainAccountId.text();

return ret;

4. In the Class Declaration of the form:

SysLookupMultiSelectCtrl    msCtrl;

5. In the Init method of the form:

msCtrl = SysLookupMultiSelectCtrl::construct(element, SSI_MultisitePostingSales_Invoice_SSI_MainAccountId,


6. On the form datasource Execute query method:

public void executeQuery()


7. On the form datasource create a new method to update the ctrl on load of the form:

public void SSI_updateMainAccountCtrl()
container       mainAccounts;

//Set the control value

//Mark the appropriate checkbox in the drop down
mainAccounts = conNull();
mainAccounts = this.SSI_createContainers();

if (mainAccounts != conNull())
// Set controls for existing records

8. On the form datasource create a new method to hold the values that should be checked on the load of the form:

public container SSI_createContainers()
List            list = new List(Types::String);
ListIterator    i;
    container       RecIds, Names;
RecId           id;

//Create Container for the RecIds, Names
list = Global::strSplit(SalesParameters.SSI_MainAccountId,";");

i = new ListIterator(list);
id = MainAccount::findByMainAccountId(i.value()).RecId;
RecIds += id;
Names += i.value();;

return [RecIds, Names];


Under the terms of this license, you are authorized to share and redistribute the content across various mediums, subject to adherence to the specified conditions: you must provide proper attribution to Stoneridge as the original creator in a manner that does not imply their endorsement of your use, the material is to be utilized solely for non-commercial purposes, and alterations, modifications, or derivative works based on the original material are strictly prohibited.

Responsibility rests with the licensee to ensure that their use of the material does not violate any other rights.

Start the Conversation

It’s our mission to help clients win. We’d love to talk to you about the right business solutions to help you achieve your goals.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!