How to get dimension value from default dimension in Dynamics AX 2012 Through X++

How to get dimension value from default dimension in Dynamics AX 2012 Through X++

static void getDimensionValueFromDefaultDimension(Args _args)
{
    DimensionAttributeValueSetStorage   dimStorage;
    DimensionValue                                   dimAttributeValue;
    Counter                                                 i;
    CustTable                                              custTable = CustTable::find('1002');
 
    dimStorage = DimensionAttributeValueSetStorage::find(custTable.DefaultDimension);

    for (i= 1 ; i<= dimStorage.elements() ; i++)
    {
        if(DimensionAttribute::find(dimStorage.getAttributeByIndex(i)).Name == 'Dimension name')
        {
               dimAttributeValue = dimStorage.getDisplayValueByIndex(i);
        }
    }
 
    info(strFmt(dimAttributeValue));
}

Comments

Popular posts from this blog

How to loop through enum in dynamics ax 2012 using x++

How to read from csv file in Dynamics AX 2012 Through X++

How to Create Transfer Journal in Dynamics AX 2012 Through X++