web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Getting BR warning "BPUpgradeCodeLateBoundCall" by calling custom method in Form Method in D365 FO

(0) ShareShare
ReportReport
Posted on by

Hi,

1. I am customizing XYZ Form. I want to initialize few fields based on newly created custom field.

2. I want to call my custom form method 'myUpdateDesign()' which I have created in Extension class of XYZ form to update design. I created the event handler of 'onModified()' method. I have initialized the FormRun object and trying to call form methods. 

[SuppressBPWarning('BPParameterNotUsed', 'Parameter e required in signature'),
    FormDataFieldEventHandler(formDataFieldStr(XYZ, myDb, myField), FormDataFieldEventType::Modified)]
    public static void myField_OnModified(FormDataObject sender, FormDataFieldEventArgs e)
    {
        FormDataObject                     caller          = sender as FormDataObject;
        FormRun                            formRun         = caller.dataSource().formRun();
        FormDataSource                     myDB_ds = caller.dataSource().formRun().dataSource(formDataSourceStr(XYZ,myDB));
        AVAProjGrant                       myDB    = myDB_ds.cursor();

        if(myDB.myField == NoYes::Yes)
        {
             formRun.myUpdateDesign(false);
        }	

}

3. It is working but I'm getting below mention BPRule error 

BP Rule: [BPUpgradeCodeLateBoundCall:A late bound call formRun.avaUpdateDesignExRateTab 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.

Can you please help me how can I use my custom form methods without BP warning?

Thanks in advance!

Regards,

Aimon Fatima

I have the same question (0)
  • Verified answer
    Blue Wang Profile Picture
    Microsoft Employee on at

    HI Aimon Fatima,

    You can find related BP suppression file at \AosService\PackagesLocalDirectory\<ModelName>\<ModelName>\AxIgnoreDiagnosticList.

    Then add:

    BestPractices
    Warning
    dynamics:// //You can get this path from warning message
    BPParameterNotUsed 
    FormDataSourceEventArgs e is mandatory parameter for events and not used in the current context.
    

  • Verified answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Aimon,

    If it's a standard form, you can only suppress the warning.

    For your own forms, you can create an interface with myUpdateDesign method. In the modified method you will need to cast formRun object to interface and execute method from the interface.

    [SuppressBPWarning('BPParameterNotUsed', 'Parameter e required in signature'),
        FormDataFieldEventHandler(formDataFieldStr(XYZ, myDb, myField), FormDataFieldEventType::Modified)]
        public static void myField_OnModified(FormDataObject sender, FormDataFieldEventArgs e)
        {
            FormDataObject                     caller          = sender as FormDataObject;
            FormRun                            formRun         = caller.dataSource().formRun();
            IMyUpdateDesign                    iMyUpdateDesign = formRun as IMyUpdateDesign; //Cast to interface
            FormDataSource                     myDB_ds = caller.dataSource().formRun().dataSource(formDataSourceStr(XYZ,myDB));
            AVAProjGrant                       myDB    = myDB_ds.cursor();
    
            if(myDB.myField == NoYes::Yes && iMyUpdateDesign != null)
            {
                 iMyUpdateDesign.myUpdateDesign(false);
            }	
    
    }

  • Community Member Profile Picture
    on at

    Thank you  Blue Wang and Sergei Minozhenko for the solution..

    Yes. It's standard form.

    I'll suppress the warning.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 521 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 438

#3
Adis Profile Picture

Adis 261 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans