The Args class

  • March 8, 2010
  • 0 Comments

The args class is probably the class u use most in Ax, and this probably even without knowing. This class is used to give arguments from one object to a new object. For example when you click on a menu-item to open a class, the menu-item will pass a args-object to Main-Method of your class.
The example under need will open the EmplTable-form and pass through the args-object.

Args args = new Args(formstr(EmplTable)); 
FormRun formRun = ClassFactory.formRunClass(args); 
; 
formRun.init(); 
formRun.run(); 
formRun.wait();

The Args-object has some interesting properies:

  • caller
    This method gets/sets the calling object.
  • record
    This method gets/sets a table buffer (common). Any buffer can be attached to the args trough this method. Make sure that you check the tablenum() on the other side before u place the common-buffer in a actual table-buffer.
  • dataset
    This method gets the tableId of the record attached. args.dataset() == args.record().tableId
  • lookupField / lookupValue
    These methods will automaticly determine witch record frow witch field should be selected.
  • parm
    This method is used to pass trough a string.
  • parmEnum / parmEnumType
    This method is used to pass trough a enum.
  • parmObject
    This method is used to pass trough any kind of object.