web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

how to insert multiple selection into the grid in ax using x++

(0) ShareShare
ReportReport
Posted on by 950

Hi all, 

i am having a grid with two fields A,B, i made a multiselect lookup for the field A.

when i click the new button on the grid, a new line (empty) is created, i select the multipile values for FieldA using multi select lookup and wheneven i click on ok in multiselect window. i need the selected values to be inserted as records in the grid. how to acheive this.  any suggestions pls

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: how to insert multiple selection into the grid in ax using x++

    Just hook in the modified method of the field that the MultiSelectLookup is linked with. Then you can iterate the values in the field, and create a records in your table. Perhaps you want to consider also deleting records if the user cleared some values from the lookup.

    You can check the Roles field on LogisticsPostalAddress form to see how some logic is triggered depending on the selected values.

  • TestBot Profile Picture
    950 on at
    RE: how to insert multiple selection into the grid in ax using x++

    Hi  Nikolaos,

    In logisticspostaladdress, if you select roles multiple like business,office etc all will append to single record for the address created. like "business;delivery;office" . i need like to create individual records for the selected values using multi lookup option

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: how to insert multiple selection into the grid in ax using x++

    Yes, I understand it.

    LogisticsPostalAddress illustrates how to get the values from MultiSelectLookup after the user has selected the values.

    So, let's split your problem in two, solving one small step at a time:

    1) Get all selected values from MultiSelectLookup after user has selected them - You can use LogisticsPostalAddress form as an example

    2) Iterate those values and create new records.

    Did you already solve part 1?

    It would be easier for me to help with part 2 if you already solved part 1. Since now I don't know how exactly you solved part 1, and my suggestion to part 2 might not be directly applicable.

    Anyway, I will try. Let's assume that you collect the selected values in a Set of strings. And now we want to create a new record corresponding each value in the set.

    Set valueSet = new Set(Types::String);
    SetEnumerator setEnum;
    str myValue;
    MyTable myTable;
    
    // Replace the following line with your actual part 1 logic
    valueSet = this.myMethodForPart1ThatWillPopulateTheSetWithMultiSelectedValues();
    
    setEnum = valueSet.getEnumerator();
    
    while (setEnum.moveNext())
    {
        myValue = seEnum.current();
        myTable.clear();
        myTable.MyField = myValue;
        myTable.insert();
    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 1,850

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 795 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 519 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans