Thursday, November 23, 2017

AX - How call form with param

Calling form with passing parameter - here it is one passed value (ProdId type):
void Check()
{
  Args args;

  FormRun formRun;

  /* -- call check form */

  args = new args();

  if ( jmgJobTable )
    args.parm( JmgJobTable.ModuleRefId );
  else
    args.parm( "" );

  ags.name( formstr( CheckBus ) );
  formRun = classFactory.formRunClass( args );
  formRun.init();
  formrun.run();
  formrun.wait();
}
..and here is receiving part - in form init() method:
public void init()
{
  ProdId prodId;

  super();

  if( element.args() )
  {
    /* -- get param value */

    prodId = element.args().parm();     
    EProdId.text( prodId );
    EOutput.text( "" );

    EProdId.setFocus();
  }
}

No comments:

Post a Comment