When a form has called another form (the user has opened a form by clicking a button in another form), you sometimes need to get information from the calling form. The traditional way is to use element.args().record(); but this construction only allows for transferring ONE datasource at a time. Sometimes it would be nice to be able to transfer more than one datasource. This is an example of how that can be done. The code must be implemented in the init -method of the CALLED form: SysSetupFormRun s; APMObjectTable apmObjectTable; int dataSourceNo; // Determine value of fields APMProductId and APMModelId of APMObjectTable record // which might have been active at the time of pressing CTRL+F4 in the previous form // (CTRL+F4 on model field in form APMCustOverview) s = element.args().caller(); if (s) { for (datasourceNo = 1; dataSourceNo <= s.dataSourceCount(); dataSourceNo++) { if (s.dataSource(dataSourceNo).cursor().TableId == tableNum(APMObjectTable)) {
My thoughts on Dynamics AX application development. I have been working as a consultant with Microsoft ERP-technology since 1994. Currently I work at Optimate A/S. My main focus is customization and application development. This blog is merely my place to put stuff that I want to remember. If anybody can benefit from reading this, that's great :0). Feel free to use any code snippets posted - but accept that you do this at your own risk!!!