Passing parameters and usage of Args class in AX:

use element.args().record(). in report or form to fetch current active(highlighted) record from a form

In dynamics AX, working with forms, there are times when you need to pass some information from current form to the opened form, so the question arrived is that what’s the best way to open the new form and pass information.

Answer: It depends upon the information that is needed in the new form; there is Args class that plays an important role to pass the information. Let’s take a look on some of the important methods of that class

Args class (Argument)

“The Args class is used to pass arguments such as a name, a caller, and parameters between application objects”

Some important methods are


Gets or sets the instance of the object that created this instance of the Args class.

Gets and sets the name of the application object to call.

Gets or sets a string that specifies miscellaneous information for the called object.

Gets or sets the enumeration value of the enumeration type that is specified in the parmEnumType method.

Gets or sets the ID value of any enumeration type.

Gets or sets an instance of any object to pass to the called object.


Gets and sets the record from the table on which the caller object is working.

There are four methods that can be used to pass extra information to the new class:

The parm method – to pass strings
The parmEnum and parmEnumType method – to pass enumeration values
The parmObject method – to pass an object of any type.


1. If you need a data from the parent form main data source for the current record, so you don’t need to do anything in parent, just create a display menu item and give the form name that needs to be opened, create a menuItem button and assign the newly created menu item.

Override the Init method on opened form

And you get the parent dataset records as


2. Need to pass any object/string/Enum
Use the same approach for creating the button

Parent form
void clicked()
Args args;
FormRun formRun;


args = new Args(formstr(FormName));
// To pass any string value
// To pass any object
// To pass any Enum
args.parmEnum( EnumValue);
args.parmEnumType( EnumNum( ) );

formRun = classFactory.FormRunClass(args);
parenttable_ds.refresh(); // Refreshing parent table DataSourceTable
parenttable_ds.executeQuery(); // Refreshing Parent DataSourceTable

Child Form
void init()
args = element.args();
// get string parameter
= args.parm();
// get object parameter
= args.parmObject();
// get enum parameter
if( element.args().parmEnumType() == EnumNum( ) )
=( element.args().parmEnum() );

3. There are many parameters that you need to pass to the child form.
In that scenario, you need to create an extra class (parameter/contract class), you can first set the parameters in the init method for that class, use the parmObject for setting and gets the object on the child form


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s