Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How To Get Values from Grid on Form By Click A Button

(1) ShareShare
ReportReport
Posted on by

Hi All..

I make a form and use CustInvoiceTrans table as the datasource of my grid.

When I open :

I'm in order to insert data from selection data on that form's grid into my new table (sjb_kompensasi_harga_table) when I click "Post".

The relation between both tables is invoiceId.

How to insert the data from the grid on form into sjb_kompensasi_harga_table?

Thank you..

*This post is locked for comments

  • Community Member Profile Picture
    on at
    RE: How To Get Values from Grid on Form By Click A Button

    752fa26b_2D00_0933_2D00_43b9_2D00_a375_2D00_536a30fb03d6.jpg

    How to display current/selected grid data onclick the View Data button

  • Suggested answer
    Faisal Fareed Profile Picture
    10,794 User Group Leader on at
    RE: How To Get Values from Grid on Form By Click A Button

    Yes it is still applicable. I would say have a look on SalesQuotationUpdate class this is used for multiple scenarios. You can check the implementation from Sales and Marketing | All Quotations | Follow up | Cancel

  • Miguel Zuniga Profile Picture
    272 on at
    RE: How To Get Values from Grid on Form By Click A Button

    Thanks Sukrut and Martin.

  • Martin Dráb Profile Picture
    233,664 Most Valuable Professional on at
    RE: How To Get Values from Grid on Form By Click A Button

    By the way, you can simplify the code with MultiSelectionHelper class.

  • Miguel Zuniga Profile Picture
    272 on at
    RE: How To Get Values from Grid on Form By Click A Button

    Hi Faisal Fareed.

    I am working on Dynamics A7/D365 and I need the same logic. Is this logic applicable to AX7/D365? 

  • Community Member Profile Picture
    on at
    RE: How To Get Values from Grid on Form By Click A Button

    Mr. Fareed,

    Great, It worked.

    Thank you a lot for the solution.

    Best Regards,

    Rizki

  • Verified answer
    Faisal Fareed Profile Picture
    10,794 User Group Leader on at
    RE: How To Get Values from Grid on Form By Click A Button

    Go to button properties and change the multiSelect property to YES.

  • Community Member Profile Picture
    on at
    RE: How To Get Values from Grid on Form By Click A Button

    Hi Mr. Fareed.

    I tried your example to my clicked void. And It worked.

    But the button is disabled when i choose multiple rows selection.

    How can i insert multiple rows selection?

    Thank You.

    Best Regards,

    Rizki

  • Verified answer
    Faisal Fareed Profile Picture
    10,794 User Group Leader on at
    RE: How To Get Values from Grid on Form By Click A Button

    Hi Rizki,

    There are many possible ways to retrieve records from grid and use it for any purpose. For your requirement could you please describe it in more details.

    A sample form screenshot for you to guide you how can get current record value or selected record value from grid.

    image

    On button click you can check either you are retrieving correct values or not.

    void clicked()
    {
    CustInvoiceTrans localCustInvoiceTarns;

    super();

    //info(CustInvoiceTrans.InvoiceId); // this is print the selected record Invoice Id in info.

    //get the first selected record of the datasource and loop through all of the selected records

    // this loop will go through all selected records from your grid and you can then use these values 
    for(localCustInvoiceTarns = CustInvoiceTrans_DS.getFirst(true) ? CustInvoiceTrans_DS.getFirst(true) : CustInvoiceTrans_DS.cursor(); localCustInvoiceTarns; localCustInvoiceTarns = CustInvoiceTrans_DS.getNext())
    {
        info(localCustInvoiceTarns.InvoiceId);
    }
    }

    You can also share your email with me I have created a small prototype for you but sorry I cannot attach .xpo file here. 

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics AX (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 100 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 48

#3
Zain Mehmood Profile Picture

Zain Mehmood 6 Moderator

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans