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();

}

No comments:

Post a Comment

Convert Call stack to readable format in D365FO X++

//Input --container _xppCallStack = xSession::xppCallStack();  Public static str POL_formatXppCallStack(container _xppCallStack, int _skipFr...