Skip to main content

How to apply filter in form's interaction class. #ax #dynamics #d365

Hello, today I'm going to demonstrate how to apply certain filters to the interaction class of a form while calling it by code in another form. 

My task was to open the ProdTableListPage form and add certain filters, but as this form is query-based, I had to do so in the interaction class. I created Coc of initializeQuery() method and applied my range.


//calling of ProdTableListPage form

   public void jumpRef()


            Args        args;

            MenuFunction menuFunction;

            args = new Args();



            menuFunction = new MenuFunction(menuItemDisplayStr(ProdTableListPage), MenuItemType::Display);




// Apply range

 public void initializeQuery(Query _query)


        FormRun formRun = this.listPage().formRun();

        if (formRun.args().callerName() && formRun.args().callerName() == formStr(PlanningFBox))


            QueryBuildDataSource dataSource = _query.dataSourceTable(Tablenum(ProdTable));


            ProdTable prodTableLoc = this.listPage().listPageArgs().externalRecord();

            dataSource.addRange(fieldNum(ProdTable, CollectRefProdId)).value(queryValue(prodTableLoc.CollectRefProdId));


        next initializeQuery(_query);




*This post is locked for comments