Hi All,
Some time we have to fetch more than 1 data source value of a form in a display method in D365 FO, but the problem is we can pass only 1 data source buffer in the display method, so to overcome this have a look to the below code, in the example I am fetching the InventDim table buffer from the inventDim dataSource of the form.
Some time we have to fetch more than 1 data source value of a form in a display method in D365 FO, but the problem is we can pass only 1 data source buffer in the display method, so to overcome this have a look to the below code, in the example I am fetching the InventDim table buffer from the inventDim dataSource of the form.
[ExtensionOf(tableStr(InventDimCombination))]
final public class InventDimCombinationTbl_Extension
{
public static display
InventQtyAvailPhysical displayAvailSupplyQty(InventDimCombination _this)
{
InventDim inventDimFind;
InventSum inventSumLocal;
InventDimParm inventDimParmLocal;
FormDataSource inventDimCombination_ds = _this.datasource();
FormDataSource inventDim_ds =
inventDimCombination_ds.formRun().dataSource("InventDim");
InventDim inventDim
= inventDim_ds.cursor();
inventDimFind.initFromInventDim(inventDim);
EcoResProductDimGroupSetup::copyProductDimensionsForItem(_this.ItemId,
_this.inventDim(), inventDimFind);
inventDimParmLocal.ItemIdFlag = NoYes::Yes;
inventDimParmLocal.InventStatusFlag =
NoYes::Yes;
inventDimParmLocal.setActiveSiteAndWarehouseDimensions();
inventDimParmLocal.setActiveProductDim(EcoResProductDimGroupSetup::newItemId(_this.ItemId));
inventSumLocal =
InventSum::findSumQty(_this.ItemId, inventDimFind, inventDimParmLocal);
return inventSumLocal.AvailPhysical;
}
}
In this way we can find any datasource value which is linked to a form in a display method
No comments:
Post a Comment