web
You’re offline. This is a read only version of the page.
close
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

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

I have the same question (0)
  • Verified answer
    Faisal Fareed Profile Picture
    10,796 User Group Leader on at

    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. 

  • Community Member Profile Picture
    on at

    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,796 User Group Leader on at

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

  • Community Member Profile Picture
    on at

    Mr. Fareed,

    Great, It worked.

    Thank you a lot for the solution.

    Best Regards,

    Rizki

  • Miguel Zuniga Profile Picture
    272 on at

    Hi Faisal Fareed.

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

  • Martin Dráb Profile Picture
    237,882 Most Valuable Professional on at

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

  • Miguel Zuniga Profile Picture
    272 on at

    Thanks Sukrut and Martin.

  • Suggested answer
    Faisal Fareed Profile Picture
    10,796 User Group Leader on at

    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

  • Community Member Profile Picture
    on at

    752fa26b_2D00_0933_2D00_43b9_2D00_a375_2D00_536a30fb03d6.jpg

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

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Sukrut Parab Profile Picture

Sukrut Parab 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans