setTmpData() on dynamically added form DataSource
axapta, dynamics-ax-2009, dynamics-ax-2012, x++
Solution
I can recommend you some things about this:
- Use the classFactory to create your form (The Args class - Classfactory)
- Instead of adding your datasource through code outside the form, try to put the temporary table as the datasource on your form.
- When you open the form the temporary table will be empty, but then you can add data by using the setTmpData(MyTemporaryRecordInstance) method. MyTemporaryRecordInstance is then a temporary table that you filled up prior to that. For more information, you can find all you need to know about temporary tables in form on the following link : Temporary tables in forms
Problem
I have added a datasource to a form using the standard pattern: ``` Args args; FormRun formRun; Form form; FormBuildDataSource formBuildDataSource; ; form = new Form(formstr(ICS)); formBuildDataSource = form.addDataSource('dbm_ICStmp'); //formBuildDataSource.table(tablenum(dbm_ICStmp)); args = new Args(); args.object(form); formRun = classfactory.formRunClass(args); formRun.init(); formRun.run(); formRun.detach(); ``` dbm_ICStmp is a temporary table. How do I call setTmpData?