Friday, January 24, 2020

How to get financial dimension values of Customers with the help of Accounting Structure using x++ in D365 FO

Hi all ,

In my last post we used the names of financial dimensions in order to get the values from Customer Master.

In this post we will see how this can be achieved by using the name of the Accounting Structure configured to be used by the customer master.

Let's see how do we do it :-

class CalculateFinancialDimensionWActStruct
    public  Str1260 calculatefinancialdim(CustTable _custtable)
        List                                                                                       dimensionAttributeList;
        ListEnumerator                                                                    listEnumerator;
        DimensionAttributeSetItem                                                 dimAttrSetItem;
        DimensionAttribute                                                             dimAttr;
        DimensionEnumeration                                                       dimensionSetId;
        DimensionService                                                                dimensionService;
        DimensionContract                                                              dimensionContract;
        AccountStructureContract                                                    accountStructureContract;
        Str1260                                                                                 dimvalue ;
        DefaultDimensionView                                                        defaultDimensionViewitem;

        dimensionSetId = DimensionCache::getDimensionAttributeSetForLedger();

        dimensionService = new dimensionService();

        accountStructureContract = new AccountStructureContract();

        dimensionAttributeList = dimensionService.getDimensions(accountStructureContract);
        listEnumerator = dimensionAttributeList.getEnumerator();

        while (listEnumerator.moveNext())
            dimensionContract = listEnumerator.current();

            select dimAttr
            join RecId from dimAttrSetItem
            where dimAttrSetItem.DimensionAttribute == dimAttr.RecId &&
                dimAttrSetItem.DimensionAttributeSet == dimensionSetId
                && dimAttr.Name==dimensionContract.parmDimensionName();

            select firstonly defaultDimensionViewitem
                where defaultDimensionViewitem.DefaultDimension ==  _custtable.DefaultDimension
                    && defaultDimensionViewitem.Name ==dimAttr.Name;

            if (defaultDimensionViewitem.RecId)
                dimvalue += '-'+defaultDimensionViewitem.DisplayValue ;
                dimvalue += '-' ;
        return dimvalue;

Happy Coding !!!


  1. Welcome to the party of my life here you will learn everything about me. uniccshop

  2. V. M. Rodionova makes an emphasize of finances, as dispersing relations when D. S. Moliakov underlines modern establishment of finances.Blake Mortgage

  3. As the cycle proceeds, and in complex utilization of financial administrations along the financial administrations esteem chain, they should save anyway for different ventures later. Comparable or much more certain connection is noticed if the mode of access and utilization is through imaginative innovation.


How to reverse Free Text Invoice Voucher entries without Dialog

 Hey Folks ,  This blog post is in continuation of the previous post for Reversing Free Text Invoice Voucher entries with Dialog. Only diffe...