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, ...
Answered

X++ for passing information from Form to New Class using MultiSelectionHelper

(0) ShareShare
ReportReport
Posted on by 95

Currently, we are developing the contents displayed in the Grid of the Form by CSV when clicking Menu Item Button from Add-On Form.

However, there are cases where only the selected lines are output as CSV, so
(MultiSelectionHelper) is used to pass the information of the selected Form to the class that outputs CSV when the button is clicked.
Also, "Onclicked" is used as the event when the button is clicked.


I would like to know specifically how to write the program.
 
pastedimage1592228504577v2.png
I have the same question (0)
  • keito yokoi Profile Picture
    95 on at
    RE: X++ for passing information from Form to New Class using MultiSelectionHelper

    Thank you very much.

    Thanks to you I was able to solve the problem.

  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: X++ for passing information from Form to New Class using MultiSelectionHelper

    No it's not ok to write that and if you would try it you would notice a compiler error. 

    _args.caller().dataSource() returns a FormDataSource object, not a table buffer.

    Also I had a mistake in my example, it's _args.record().dataSource(), not _args.caller().record().dataSource().

    Anyway, here are some results for MultiSelectionHelper: www.google.com/search

    And, when we combine everything we learned so far in this discussion, we will get something like this:

    pubic static void main (Args _args)
    {
        FormDataSource fds = _args.record().dataSource();
        MultiSelectionHelper msh = MultiSelectionHelper::construct();
        msh.parmDataSource(fds);
        
        MyTable myTable = msh.getFirst();
        
        while (myTable)
        {
            info(myTable.MyField);
            myTable = msh.getNext();
        }
    }

  • keito yokoi Profile Picture
    95 on at
    RE: X++ for passing information from Form to New Class using MultiSelectionHelper

    Is it okay to write _args.caller().record().dataSource(). as "Table table = _args.caller().record().dataSource()"?

    About MultiSelectionHelper, did you try to search any information in the web? There's plenty. Just let me know if you need me to find some article.

    ⇒

    I would appreciate it if you could give me an article.

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: X++ for passing information from Form to New Class using MultiSelectionHelper

    I mean the class that outputs the CSV. You don't need any "OnClicked" things anywhere. Simply a menu item button that points to your new class.

    About MultiSelectionHelper, did you try to search any information in the web? There's plenty. Just let me know if you need me to find some article.

  • keito yokoi Profile Picture
    95 on at
    RE: X++ for passing information from Form to New Class using MultiSelectionHelper

    >In your new class you can access the caller form data source via _args.caller().record().dataSource().

    ⇒ In your new class. Is it an "Onclicked" class? Or is it a class that outputs CSV?

    >Then you can launch MultiSeelctionHelper with this data source and fetch the records.

    ⇒I don't understand this yet.

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: X++ for passing information from Form to New Class using MultiSelectionHelper

    In your new class you can access the caller form data source via _args.caller().record().dataSource().

    Then you can launch MultiSeelctionHelper with this data source and fetch the records.

    Is it now clear?

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…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

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

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 665 User Group Leader

#2
Martin Dráb Profile Picture

Martin Dráb 595 Most Valuable Professional

#3
Yng Lih Profile Picture

Yng Lih 558

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans