Tuesday, 4 September 2018




How to make display method in D365



1. Create new Class with Extension
2. Write your method with Cache syntax.
3. take new field in form 
4. give Datasource and datamathod as classname::method name in Field properties
5. yes to Cache Data method in Field properties


public static class DisplayVATAmount_Extension
{

    // display method to check available qty onhand by item with warehouse
    public static display real QtyAvail(SalesLine _this)
    {
        InventOnhand                     inventOnHand;
        InventDimParm                    inventDimParm;
        InventQty                        availQty;
        InventDim                        inventdim;
       

        inventDim.InventLocationId = inventDim::find(_this.InventDimId).InventLocationId;
    // inventDim.InventLocationId = inventDim::find(SalesLine.InventDimId).InventSiteId;
   
    inventDimParm.initFromInventDim(inventDim);
       
        inventOnHand = inventOnHand::newParameters(_this.ItemId,inventDim,inventDimParm);
       
    availQty = inventOnHand.availPhysical();
    return availQty;
    }
 }

Data mathod : DisplayVATAmount_Extension::QtyAvail




Thanks
Akshay

No comments:

Post a Comment