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

BP error late bound call formRun.init

(0) ShareShare
ReportReport
Posted on by 230

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!
I have the same question (0)
  • Sergei Minozhenko Profile Picture
    23,097 on at

    Hi Willem,

    As far as I know, there is no solution yet except suppress BP warning if it's related to standard form.

    There was discussion in "Insider program" yammer channel and at least for custom forms, there was a suggestion to use interfaces, but for the standard forms it's not possible.

  • Suggested answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    Btw you can run a menu item by using MenuFunction class. Perhaps it solves the bp issue.

  • Willem van Duren Profile Picture
    230 on at

    Thank you both for your replies.

    Could you advise how I couldachieve the same functionality with the MenuFunction class? I have an action menu item names ELCWDNettReqSCMI.

    Thanks!

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

    Hi Willem,

    Have you tried approach described in community.dynamics.com/.../calling-menu-item-with-args-x

  • Willem van Duren Profile Picture
    230 on at

    Hi Sergei,

    I tried this:

    private void openNettReq(itemid _itemid)

       {

           Args                            args;

           Object                          formRun;

           CompanyInfo                     companyinfo;

           DataAreaId                      sccompany;

           //Retrieve ELCEE 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.caller(this);

               new MenuFunction(menuItemOutputStr(ELCWDNettReqSCMI), MenuItemType::Action).run(args);

           }

       }

    }

    I get the following error:

    "The 'ELCWDNettReqSCMI' argument of the 'MenuItemOutputStr' compile-time function does not specify a known menu item output.

  • Verified answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    Use menuItemActionStr for action menu items.

  • Willem van Duren Profile Picture
    230 on at

    Thanks both of you :-)!

    It works.

    Code used is:

       args = new Args();

       args.record(inventtable::find(_itemid));

       args.name(formstr(reqtransoverview));

       new MenuFunction(menuItemDisplayStr(ReqTransNet), MenuItemType::Display).run(args);

  • Willem van Duren Profile Picture
    230 on at

    It also solved the BP messages :)

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 797

#2
André Arnaud de Calavon Profile Picture

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

#3
Subra Profile Picture

Subra 534

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans