Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

How to update database from a form in AX 2009

(0) ShareShare
ReportReport
Posted on by 790

I'm new to X++ development.  I have done several ASP.Net projects using the AX .Net business connector but this is my first attempt at true X++ development.

So far, I have created a form with 2 tabs.  The first tab has a grid control which displays all rows from my table WfsProd.  I can then select a row by clicking it and then click my second tab which displays this row with each field in a stringedit or realedit field.  So far, this all works.

But now I want to let the user change any of these fields and save it back to table WfsProd.  This is where I need help.  Can't seem to find any web sites that explain how to do this.

*This post is locked for comments

  • PA-22040759-0 Profile Picture
    PA-22040759-0 6,194 on at
    RE: How to update database from a form in AX 2009

    Allright, your form is probably ok. But you have a compilation error in a method on the table.

    You must go to the Data Dictionary\Tables\WfsProd\Methods\validateField method and figure out what's wrong with it. This method is called every time you modify a field on this table from any form.

  • Robert Herrmann Profile Picture
    Robert Herrmann 790 on at
    RE: How to update database from a form in AX 2009

    I just tried that.  I clicked on one of the string values and I was presented with a dropdownlist.  I clicked on a different value and then got this error:

    "Error executing code: WfsProd (table) has no valid runnable code in method 'validateField'.  (C)\Data Dictionary\Tables\WfsProd\Methods\validateField(C)\Classes\FormStringControl\Modified"

    I get this error as soon as a click a new value.  Actually, this is the also the same error I get on the Details tab when I try to change a value of a field.

  • PA-22040759-0 Profile Picture
    PA-22040759-0 6,194 on at
    RE: How to update database from a form in AX 2009

    That seems right.

    Are you able to edit and save the data that are shown on the first tab page?

  • Robert Herrmann Profile Picture
    Robert Herrmann 790 on at
    RE: How to update database from a form in AX 2009

    The StringEdit and RealEdit fields on the second tab are bound using the same data source as the grid.  Maybe this is incorrect.  I really do not know how to do this and that is why I am asking for help.

  • Martin Dráb Profile Picture
    Martin Dráb 230,445 Most Valuable Professional on at
    RE: How to update database from a form in AX 2009

    Do you want to say that controls on the second tab aren't bound to any data source? Why?

  • Robert Herrmann Profile Picture
    Robert Herrmann 790 on at
    RE: How to update database from a form in AX 2009

    I already have the grid populated from the datasource which is based on table WfsProd.  I then highlight a row in the gird and click on my second tab named Details.  I now see all my fields as textboxes or dropdownlists.  Now how do I allow changes to be made to this data and how do I save the changes back to the WfsProd?

  • Suggested answer
    PA-22040759-0 Profile Picture
    PA-22040759-0 6,194 on at
    RE: How to update database from a form in AX 2009

    Basically you should have your WfsProd table as a datasource on the form, and the you can drag fields from the datasource into the design parts, for example the grid. That's it.

    You might want to look into if the table has the "AllowEdit" property set to No, either on the table itself or the form datasource if you cannot edit the fields you already have.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans