Thursday, August 15, 2019

Calling Action Menu item in D365 Finance and Operations X++

Below is the example I created for demonstrating how to call a menu item from X++. In this example I'm calling sales packing slip menu item for posting sales packing slip for all lines.


class SW_TestClassDebug
{     
    /// <summary>
    /// Runs the class with the specified arguments.
    /// </summary>
    /// <param name = "_args">The specified arguments.</param>
    public static void main(Args _args)
    {
        MenuFunction    menuFunction;
        salestable _SalesTable = SalesTable::find("SO00125111");
        Args            args = new Args();

        args.record(_SalesTable);

        menuFunction = new MenuFunction(menuitemActionStr(SalesFormLetter_PackingSlip), MenuItemType::Action);

        if (menuFunction && menuFunction.checkAccessRights())
        {

            menuFunction.run(args);
        }
    }

}

2 comments:

  1. I high appreciate this post. It’s hard to find the good from the bad sometimes, but I think you’ve nailed it! would you mind updating your blog with more information? link

    ReplyDelete
  2. Nice use of Args and MenuFunction! I tested a similar automation using mod engine 2 to streamline repetitive menu actions works like a charm.

    ReplyDelete

What is the primary purpose of using a Solution in Microsoft Power Platform & ALM?

As organizations embrace low-code development with Microsoft Power Platform , it becomes essential to manage and govern apps, flows, and dat...