MenuFunction.new Method [AX 2012]

Creates a new xMenuFunction object by passing xMenuFunction's name and MenuItemType to the xMenuFunction constructor.

public void new(str _Name, MenuItemType _type)

Run On

Called

Parameters

_Name
Type: str

_type
Type: MenuItemType Enumeration

When creating a xMenuFunction object, the parameters must uniquely identify an existing xMenuFunction. If not, Exception::Internal is thrown.

In the following example, a try block tries to create and run an object of type MenuFunction. The catch block then handles the specific system class exception and prints an error message.

MenuFunction mf; 
 
try 
{ 
    mf = new MenuFunction("AddressFormat", MenuItemType::Display); 
    mf.run(); 
} 
 
// Exception handler. 
catch(Exception::Internal) 
{ 
    print "MenuFunction does not exist"; 
    pause; 
}

Community Additions

ADD
Show: