Monday, 4 May 2020

Invent Onhand Unretrieved Fields Issue

Classes : InventDimCtrl_Frm_OnHand

\Classes\InventDimCtrl_Frm_OnHand\modifyQueryBasedOnDatasourceName

if (groupByNameAlias)
{
        inventTableDataSource = query.dataSourceTable(tableNum(InventTable));
        if (inventTableDataSource)
       {             query.dataSourceTable(tableNum(InventTable)).addGroupByField(fieldNum(InventTable, NameAlias));             
            query.dataSourceTable(tableNum(InventTable)).addGroupByField(fieldNum(InventTable, PrimaryVendorId)); // Add your Fields here
           
       }
}

We can also Join Other Tables :
if (groupByNameAlias)
    {
        inventTableDataSource = query.dataSourceTable(tableNum(InventTable));

        inventItemGroupItemDataSource = inventTableDataSource.addDataSource(tableNum(inventItemGroupItem));
        inventItemGroupItemDataSource.relations(true);

        EcoresProductDataSource =  inventTableDataSource.addDataSource(tableNum(EcoresProduct));
        EcoresProductDataSource.relations(true);

        EcoResproductCategoryDataSource = EcoresProductDataSource.addDataSource(tableNum(EcoResproductCategory));
        EcoResproductCategoryDataSource.relations(true);

        EcoResCategoryDataSource = EcoResproductCategoryDataSource.addDataSource(tableNum(EcoResCategory));
        EcoResCategoryDataSource.relations(true);

if (inventTableDataSource)
        {
            query.dataSourceTable(tableNum(InventTable)).addGroupByField(fieldNum(InventTable, NameAlias));
            query.dataSourceTable(tableNum(InventTable)).addGroupByField(fieldNum(InventTable, Itembuyergroupid));
          query.dataSourceTable(tableNum(InventTable)).addGroupByField(fieldNum(InventTable, PrimaryVendorId));
        }

        if(inventItemGroupItemDataSource)
        {            query.dataSourceTable(tableNum(inventItemGroupItem)).addGroupByField(fieldNum(inventItemGroupItem, ItemGroupId))
       }
        if(EcoResCategoryDataSource)
        {
query.dataSourceTable(tableNum(EcoResCategory)).addGroupByField(fieldNum(EcoResCategory, Name)); 
       }     
}

POSTMAN D365

  Postman is useful to test the behavior of different OData class from/to D365FO. In this post we will see the steps to setup Postman with D...