Search This Blog

Tuesday, June 4, 2013

Open the Listpage form from another form by passing parameter in axapta 2012

In axapta 2012 all the common forms are listpage forms , In list page form we can't override any method so any validation can be done through ListpageInteraction Class .
My intention is open the Listpage form from another form, so for that  we need to change the code in InitializeQuery  method of ListpageInteraction class.
1) Override the clicked method of menuitembutton of Calling form
ex:
FormRun formRun;

Args args = New Args();
super()
args.name(EAMWorkRequestListPage);
args.parmEnum(EAMWorkstatus::WaitingForAuthorization);
formRun = ClassFactory.formRunclass(args);
formRun.init();
formRun.run();
formRun.wait()
 
2) Based on passing enumvalue the Listpage will be filtered by overriding the InitializeQuery method of ListpageInteraction class.
 
if(this.listPage().listPageArgs() && this.listPage().listPageArgs().enumParameter())
    {
        status = this.listPage().listPageArgs().enumParameter();
        qbds = _query.dataSourceTable(tableNum(EAMWorkRequest));
        qbds.addRange(fieldNum(EAMWorkRequest,Status)).value(queryValue(status));
    }
Also we can refer the existing classes like ProdTableListPageInteraction\initializeQuery
 
 
 
 
  
  

1 comment: