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

Announcements

No record found.

News and Announcements icon
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 958

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,172 Moderator on at

    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
    958 on at

    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,172 Moderator on at

    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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 689

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 606 Super User 2026 Season 1

#3
CP04-islander Profile Picture

CP04-islander 356

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans