Post Load Method in Data Entity in D365

 

// post load method in data entity

public class BA_UnifonicOrderSendDataEntity extends common

{

    /// <summary>

    ///

    /// </summary>

    public void postLoad()

    {

        SalesTable salesTable;

        ARF_CapacityMasterTable masterTable;

        SalesLine salesLine;

        SalesQty totalOrderedQty;


        super();

        

        select SalesId, ARF_DestinationCode, ShippingDateConfirmed from salesTable where salesTable.SalesId == this.SalesId;

        select sum(SalesQty) from salesLine where salesLine.SalesId == salesTable.SalesId;

        totalOrderedQty = salesLine.SalesQty;


        select firstonly RecId, ARF_Date from masterTable

            where      masterTable.ARF_Capacityid == salesTable.ARF_DestinationCode

                    && masterTable.ARF_Date > salesTable.ShippingDateConfirmed

                    && masterTable.ARF_CubeCapValue >= totalOrderedQty;


        if(masterTable.RecId)

        {

            this.NextAvailableDeliveryDate = masterTable.ARF_Date;

        }


    }


}

Comments

Popular posts from this blog

how to post trade agreement journals automatically using x++ code

How to Create a wizard in x++ d365

x++ code to submit and approve and reject the invent movement workflow in d365 F&O