Showing posts with label Get Default Dimension values and names in Ax 2012. Show all posts
Showing posts with label Get Default Dimension values and names in Ax 2012. Show all posts

Monday, 3 September 2018

Get Default Dimension values and names in Ax 2012

#define.Product('Products')
#define.ProfitCenter('ProfitCenter')

Name                                ProfitcenterUnit,ProductUnit;
DimensionAttributeValueSetStorage   dimStorage;
DimensionFinancialTag               dimensionFinancialTag;


dimStorage = DimensionAttributeValueSetStorage::find(custtrans.defaultdimension);
        for(i=1 ; i<= dimStorage.elements() ; i++)
        {
            if(DimensionAttribute::find(dimStorage.getAttributeByIndex(i)).Name == #Product)
            {
                ProductUnit = dimStorage.getDisplayValueByIndex(i);
            }
            if(DimensionAttribute::find(dimStorage.getAttributeByIndex(i)).Name == #ProfitCenter)
            {
                ProfitcenterUnit = dimStorage.getDisplayValueByIndex(i);

                select Value,Description from dimensionFinancialTag where dimensionFinancialTag.Value == ProfitcenterUnit;
                branchname = dimensionFinancialTag.Description;
            }
        }