Tuesday, 3 July 2018

Data Entity field with IsComputed field is yes in dynamics 365

IF IsComputed field is yes in dataentitys which is unbounded control fields
Change the below properties on the unbounded field level IsComputed field is yes
-Add the EDT
-Data Entity view method - GHMCRetrieveBalance
public class GHMCCustomerBalanceEntity extends common
{
    /// <summary>
    /// Retrieves Balance of the Customer
    /// </summary>
    /// <returns></returns>
    public static str GHMCRetrieveBalance()
    {
       
        str balance;

        balance = @'
            SELECT SUM(CUSTTRANSOPEN.AMOUNTMST) FROM CUSTTRANS
            join  CUSTTRANSOPEN on CUSTTRANS.RecId = CUSTTRANSOPEN.RefRecId
            and CUSTTRANSOPEN.DATAAREAID = T1.DATAAREAID
            group by CurrencyCode,custTrans.ACCOUNTNUM
            having custTrans.ACCOUNTNUM = T1.ACCOUNTNUM
            ';

        return balance;
    }

    /// <summary>
    /// Retrieves Current Balance
    /// </summary>
    /// <returns></returns>
    public static str GHMCRetrieveCurrentBalance()
    {
       
        str currentBalance;
       
        currentBalance = @'
                SELECT (CREDITMAX -(SELECT SUM(ESTIMATE) FROM SALESTABLE
                WHERE CUSTACCOUNT = T1.ACCOUNTNUM AND DATAAREAID = T1.DATAAREAID))
                AS CURRENTBALANCE FROM CUSTTABLE WHERE ACCOUNTNUM = T1.ACCOUNTNUM
                AND DATAAREAID = T1.DATAAREAID
                ';

        return currentBalance;
    }

}

No comments:

Post a Comment

DefaultDimension in d365 FO X++

 Navigate to PurchTable methods you can find with DefaultDimension this.DefaultDimension = this.mergeDimension(this.getDefaultDimension(),th...