I have a button 'OK' in ProdParmReport that I want to disable on condition. AutoDeclaration is set to NO.
My code returns object reference error in axapta. How can I call it correctly ?
[ExtensionOf(formdatasourcestr(ProdTableListPage, ProdTable))]
final class ProdParmReportFinishedActiveWG_Extension
{
public int active()
{
int ret;
next Active();
{
ProdTable tableBuffer = this.cursor();
ProdTable prodtable;
if(tableBuffer.ProdId == tableBuffer.InventRefId
|| tableBuffer.InventRefType == InventRefType::None
|| tableBuffer.ProdStatus != ProdStatus::ReportedFinished)
{
while select RecId,ProdId from ProdTable where
ProdTable.InventRefId == tableBuffer.ProdId
&& ProdTable.Prodstatus != ProdStatus::ReportedFinished
{
// FormButtonControl mybutton = this.FormRun().design().controlname(formControlStr(ProdParmReportFinished, Ok)) as FormButtonControl;
// mybutton.enabled(false);
Global::info(strFmt("%1 , %2",
prodtable.prodid, prodtable.recid));
}
}
else
{
Global::info(strFmt("%1 , %2",
tableBuffer.prodid, tableBuffer.recid));
}
}
return ret;
}
}