Skip to main content

Notifications

Announcements

No record found.

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 Microsoft Employee

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
    Community Member Microsoft Employee 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
    Faisal Fareed 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
    Miguel Zuniga 270 on at
    RE: How To Get Values from Grid on Form By Click A Button

    Thanks Sukrut and Martin.

  • Martin Dráb Profile Picture
    Martin Dráb 231,321 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
    Miguel Zuniga 270 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
    Community Member Microsoft Employee 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
    Faisal Fareed 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
    Community Member Microsoft Employee 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
    Faisal Fareed 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 Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,321 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans