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
how to get the field id from the form ?
Probably just need a refresh data on the form. Best is to call the research method on the datasource after importing.
Basic sample on how to save value from form
formDataSource = myFormStringControlObject.DataSource();
formDataSource.object(fieldId).setValue('Value');
Do you have any code in insert ? Can you share your code what you are doing ?
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?
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.
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.
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.
The manual process that the business currently does, is
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?
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).
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,188 Super User 2024 Season 2
Martin Dráb 230,030 Most Valuable Professional
nmaenpaa 101,156