Args class

The Args system class is one of the most widely used classes in Axapta. Args is an abbreviation for arguments and an Args object is used to pass information from one object (caller) to another newly created object.

Using Args for object creation
Args    args = new Args("CustTable");
 FormRun formRun = ClassFactory.formRunClass(args);


public Object caller( [Object _value] )

this method gets or sets the calling object. When creating an args object directly through code, the caller will not be automatically set, so you should set it yourself.


public Common record( [Common _value] )

this method gets or sets a table buffer (record) attached to the Args. A buffer of any table can be attached to an Args object using this method. Be aware when retrieving the buffer that there will be no compile-time check of table id. You should use the dataset method below to check the contents of the buffer.

If the caller and callee are on different tiers, then the applications will automatically copy the buffer to the target tier.


public tableId dataset()

this method gets the table Id of a table buffer (record) attached to the Args.
To safely retrieve an attached record from an Args object, use code similar to that shown below. This checks to ensure that there is an attached record, and that it is in fact a SalesTable record, before trying to assign it to the salesTable variable.

if (args.record() && args.dataset() == tableNum(SalesTable))
  salesTable = args.record();


public str parm( [str _value] )
parm is used to pass a string variable to the called object


public anytype parmEnum( [int _value] )
see parmEnumType


public int parmEnumType( [int _value] )
parmEnum and parmEnumType are used together to pass a Base Enum value through to the called object. An example is shown below.


public Object parmObject( [Object _value] )
parmObject is used to pass a reference to any object to the called object. Be aware of client-server issues if the caller and callee are on different tiers.


public final str menuItemName( [str _value] )


public final MenuItemType menuItemType( [MenuItemType _value] )

A short tutorial on how to open a form in Dynamics Ax (Axapta) by code.

Just take a line of code:

new MenuFunction(MenuItemDisplayStr(CustTable),MenuItemType::Display).run();

The above code will open the CustTable form. That's all it takes.

Now if you want to supply some arguments to the opening form, this is also possible with the optional args parameter.

static void FormOpen()
Args args = new Args();
new MenuFunction(MenuItemDisplayStr(CustTable),MenuItemType::Display).run(Args);

This code will open the CustTable form and filter out the customer with accountnumber CUS-001.


  1. Thank you for your Valuable Information.

  2. Very nice explanation of all args implementations. Thankyou !

  3. how we insert data in a table through dialog.
    1- icreate a dialog and i want to insert data in a table and show in grid below the tab


Powered by Blogger.