On hand Inventory for Item X++ extensions Dynamics 365 for finance and operations

Today is very small tip. Today is Eid day, Very warm wishes for Eid holidays.
Here is code snippet for  on hand inventory method. I wrote with extension.
For for extension. create a new class and add attribute on Extension fo Class.
[ExtensionOf(tableStr(PurchLine))]
public static class  PurchLine_Extension
{
    [SysClientCacheDataMethodAttribute(true)]  //This attribute will cache your display method.
    public static display Real  MYOnHand( PurchLine _this)
    {
        InventOnHand inventOnhand;
        InventDim       InventDim;
        InventDimParm inventDimParm;
        inventDimParm.initFromInventDim(_this.inventDim());
        inventOnHand = InventOnhand::newParameters(_this.Itemid,_this.InventDim(),inventDimParm);
        return inventOnHand.availPhysical();
    }
}

alirazazaidi

Ali Raza Zaidi, Microsoft ERP Consultant, Currently working for Business Experts Gulf in United Arab Emirates. Specialized in HR & Payroll, Supply Chain and Financials modules.