Good evening all!
We have a multicompany setup in our D365 FO environment. I have a Supply company and a Salescompany. Because our sales people would like to look at Nett requirements in the Supply chain company, I made a button which jumps to the other company and starts the Nett Req. Works fine.
However: I get the following Best Practice error:
A late bound call formRun.init is made. In source system (AX 2012) it is possible to dynamically call methods where the number and type of the parameters does not match with the method definition. This is not supported in AX 7, where the number and types of parameters have to match. Even if the parameters do match, the late bound call is extremely expensive. Mitigation: Use a class or interface hierarchy to provide a type safe fast call, or use the IS and AS operators to cast to a known type before calling.
I really have no clue what they mean to be honest and how to solve this. Can anyone help me with this ?
My code is as follows:
private void openNettReq(itemid _itemid)
{
Args args;
Object formRun;
CompanyInfo companyinfo;
DataAreaId sccompany;
//Retrieve supply chain company
select firstonly companyinfo where companyinfo.DataArea==curExt();
if(companyinfo.ELCSupplyChainCompany)
{
sccompany=companyinfo.ELCSupplyChainCompany;
}
else
{
sccompany=curExt();
}
changeCompany(sccompany)
{
args = new Args();
args.record(inventtable::find(_itemid));
args.name(formstr(reqtransoverview));
formRun = classfactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.wait();
}
}
Thank you very much in advance!