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)

Save function of form

(0) ShareShare
ReportReport
Posted on by

I have a form that manually needs to be saved before I can firm the form. 

If the save button is not pressed by the user, information is not transferred over after firming.

What code can I write that will create the functionality that the save button does?

*This post is locked for comments

I have the same question (0)
  • Rohin Profile Picture
    4,624 on at

    is this customized Form??

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    Calling .write() method on the form datasource is how you could force a save, which either inserts the record if it does not exist in the database, or updates it with the changes if it does, for your table/field-bound form controls..

  • Rohin Profile Picture
    4,624 on at

    Hi Vilmos,

    I have question for you : does we need to override write() method on formdatasource ..would it not called by AX automatically when we insert or Update the record on form..

    Hoping for your comments

  • Sukrut Parab Profile Picture
    71,710 Moderator on at

    you don't have to override write method , it gets called automatically . check the call stack if you want to see how it executes

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    You are confused. Method override means you could add additional logic while calling the standard/kernel functionality at the same time (via super call, or you can completely omit that) as with any other object oriented programming language. What I am saying is on top of the regular methods to save the record, which the original poster was asking about, they could just call the (either overridden, or not) write method explicitly, which in the background decides if it should be an insert, or update operation.

  • Rohin Profile Picture
    4,624 on at

    But that the question : why we need to call write method explicitly if AX kernel manage it automatically (assumed we don't have additional logic) ?

  • Community Member Profile Picture
    on at

    Sorry, my question is a little confusing. Let me explain a little better.

    I have a form that pulls information from a table. The expected behavior is, after the form is imported into ax, the user can press the firm button and the information is moved to another form.

    What is happening right now, is the user must press the save button after importing, then press the firm button. If the user doesn't, the 2nd form is missing important information from the 1st form. 

    What code can I write that will create the functionality that the save button does?

  • Suggested answer
    Chaitanya Golla Profile Picture
    17,225 on at

    Hi,

    Can you provide some more information on importing form into ax means, as I am bit confused. If data is imported into ax successfully, then form when opened this data is loaded into formdatasource in a saved state. As a part of some event, if you want to get the latest data then you can use formdatasource.executequery() or can use args class to send parameters from one form to another form, if data is not passing as expected.

    (passing parameters between forms in AX)

    arsalanax.blogspot.in/.../passing-paramters-between-forms-in-ax.html

    Please let me know if I am missing something.

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    Based on your explanation, you do not have to do anything as long as the Save record property is set on the button control.

    msdn.microsoft.com/.../formbuttoncontrol.saverecord.aspx

    Pressing the button would automagically save the value for you, before opening the form (as long as you did not uncomment the super() call).

  • Community Member Profile Picture
    on at

    The manual process that the business currently does, is

    1. Press 'New Order' button from Form A, which opens a pre-filled dialog box
    2. Chooses item
    3. Choose the warehouse
    4. Select the quantity
    5. Press Save
    6. Select the order on Form A
    7. Press firm button 
    8. User goes to Form B and makes sure all information has been transferred over

    What's currently I have programmed into AX is an import  from an excel spreadsheet. During import, the information from the spreadsheet is being inserted to a table that Form A reads from. Once the form has pulled all necessary information, the user selects the order and presses the firm button.

    On Form B, necessary information is missing that had already been pulled in from Form A.

    The only way that I have been able to get the missing information from form A to Form B, is by pressing the save button on Form A before the firm button.

    I am trying to emulate the save button in my import process because if I just go to Form B, the information is missing.

    How can I see the logic that is happening behind the save 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
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans