Tuesday, August 18, 2020

Solution for BP: BP RULE -> BPUpgradeCodeLateBoundCall

 

BP:

BPUpgradeCodeLateBoundCall: BP Rule: [BPUpgradeCodeLateBoundCall]:A late bound call callingForm.refresh 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.

Calling form method in another FORM>

Solution:

1. Interface class ( new class for form)

   interface MyCustomFormInterface
 {
    public void refresh() // in my case method name is refresh
{
}
}

2. Go to Form -> MyCustomForm

   In declaration, add implements MyCustomFormInterface

3. In caller form

//get callerFormRun

MyCustomFormInterface frInterface = callerFormRun as MyCustomFormInterface

if(frInterface)

{

frInterface.refresh();

}

Wednesday, August 12, 2020

Fetch Product/Storage/Tracking dimension enabled or disabled based on itemId

 InventTable     inventTable;

   InventDimParm   inventDimParm;

   inventTable   = InventTable::find('A0001');

   inventDimParm =  InventDimParm::activeDimFlag(InventDimGroupSetup::newInventTable(inventTable));

   if(inventDimParm.InventLocationIdFlag)

   {

       info("warehouse is Enabled");

   }

Upload data from Excel in D365FO X++

 Action Menu Item: SAN_UploadExcelData Object type: Class Object: <Controller class name> Label: <> Class: Controller class clas...