Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Save function of form

Posted on by Microsoft Employee

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

  • MostafaDeve Profile Picture
    MostafaDeve 30 on at
    RE: Save function of form

    how to get the field id from the form ?

  • Suggested answer
    dynamics developer Profile Picture
    dynamics developer 1,272 on at
    RE: Save function of form

    Probably just need a refresh data on the form. Best is to call the research method on the datasource after importing.

  • Suggested answer
    JII SAADUDDIN Profile Picture
    JII SAADUDDIN 1,832 on at
    RE: Save function of form

    Basic sample on how to save value from form

    formDataSource = myFormStringControlObject.DataSource();

    formDataSource.object(fieldId).setValue('Value');

  • Sukrut Parab Profile Picture
    Sukrut Parab 71,647 Moderator on at
    RE: Save function of form

    Do you have any code in insert ? Can you share your code what you are doing ?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Save function of form

    So I it almost works now!

    I use .write() right after .insert(), but get back 2 lines of data instead of 1. I can't get the process to work if I delete .insert().

    How can I fix this?

  • Suggested answer
    Deepak Agarwal Profile Picture
    Deepak Agarwal 148 on at
    RE: Save function of form

    You can try to override clicked method of Firm button and call ds.write() method explicitly.

    However if you using  D365, you may need to override the object or use Delegate method. Because you will not be able to write anycode in method using extensions.

    Hope it will help.

  • Suggested answer
    Sukrut Parab Profile Picture
    Sukrut Parab 71,647 Moderator on at
    RE: Save function of form

    Is import from excel  is independent process or you are pressing import button on the form ? You have to check your code in excel import process , debug the code to see what's going on. Also see if form is refreshing properly.

  • Suggested answer
    Vilmos Kintera Profile Picture
    Vilmos Kintera 46,149 on at
    RE: Save function of form

    Put breakpoints on the insert/update/write methods on the AOT Table involved (override methods if necessary), and work your way back through the call stack to see what is happening, using the AX Debugger.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Save function (AX 2009)

    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?

  • Suggested answer
    Vilmos Kintera Profile Picture
    Vilmos Kintera 46,149 on at
    RE: Save function (AX 2009)

    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).

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,030 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans