Hello,
I created a form that has InventTrans as the main datasource. From this form, I run the standard ProdTableCreate form :)
The requirement is that the ProdTableCreate form, when opened, is already populated with values from the selected line from the InventTrans form. Everything works OK, the form is populated with values, it creates a production order, but I always get the well-known error "Object reference not set to an instance of an object." at the end of steps.
I did some debugging and the error appears in the standard refreshCaller method at common_ds.research(). When executing the method, the common_ds variable has the null value..
Can anyone suggest what I am doing wrong?
standard refreshcaller() method:
void refreshCaller() { Common common; Common commonDim; FormDataSource common_ds; FormDataSource commonDim_ds; if (element.args().dataset() == tableNum(SalesLine)) { common = element.args().record(); common_ds = FormDataUtil::getFormDataSource(common); common_ds.reread(); common_ds.refresh(); commonDim = common.joinChild(); if (commonDim.TableId == tableNum(InventDim)) { commonDim_ds = FormDataUtil::getFormDataSource(commonDim); commonDim.data(InventDim::find(prodTable.InventDimId)); commonDim_ds.setCurrent(); } } else if ( element.args().record() ) { common_ds = FormDataUtil::getFormDataSource(element.args().record()); common_ds.research(); }
init() method extension:
public void init() { InventMovement callerMovement; Object callerFormObject; ProdTable prodTableLocal; ProdIProdTableDefaultValuesProvider prodTableDefaultValuesProvider; next init(); if (this.args() && this.args().caller()) { callerFormObject = this.args().caller(); switch (this.args().dataset()) { case (tablenum(InventTrans)) : callerBuffer = this.args().record(); break; default: } } }
refreshCaller() method extension:
void refreshCaller() { Common common; Common commonDim; FormDataSource common_ds; FormDataSource commonDim_ds; if (this.args().dataset() == tableNum(InventTrans)) { common = this.args().record(); common_ds = FormDataUtil::getFormDataSource(common); common_ds.reread(); common_ds.refresh(); commonDim = common.joinChild(); if (commonDim.TableId == tableNum(InventDim)) { commonDim_ds = FormDataUtil::getFormDataSource(commonDim); commonDim.data(InventDim::find(prodTable.InventDimId)); commonDim_ds.setCurrent(); } } next refreshCaller(); }