Wednesday, April 20, 2022

Add default filter in Systemdefinedfiterpane in D365FO

 Today we see to add default filter in Systemdefinedfiterpane.




For this we need to use QueryFilter class. Write the below method in form init method. I am using vend group table.


[ExtensionOf(formStr(VendGroup))] public final class TestVendGroupForm_Extension { public void init() { next init(); // QueryFilter qFilter; QueryBuildDataSource qbd = VendGroup_ds.queryBuildDataSource(); // qFilter = VendGroup_ds.query().addQueryFilter(qbd, fieldStr(VendGroup, PaymTermId)) VendGroup_ds.query().addQueryFilter(qbd, fieldStr(VendGroup, PaymTermId)); //VendGroup_ds.query().addQueryFilter(qbd, fieldStr(VendGroup, Name));         

        // ------Or---------------         this.addFilterPaneRanges(); }     /// <summary> /// Adds ranges to filter pane. /// </summary> protected void addFilterPaneRanges() { QueryBuildDataSource inventSumQbds = InventSum_DS.query().dataSourceName(InventSum_DS.name()); SysQuery::findOrCreateRange(inventSumQbds, fieldNum(InventSum, ItemId)); QueryBuildDataSource inventTableQbds = InventTable_DS_DS.query().dataSourceName(InventTable_DS_DS.name()); SysQuery::findOrCreateRange(inventTableQbds, fieldNum(InventTable, NameAlias));

    } }


Keep Daxing!!

No comments:

Post a Comment