AX – D365FO – Get individual dimensions value from Ledger Dimension in X++

In this example method we pass 2 parameters :

  • Ledger dimension record
  • An Attribute named “BusinessUnit”. The attribute of which we want to retrieve the value

This methods returns the sigle dimension Attribute value

static DimensionDisplayValue getAttributeValueFromCombination(
    DimensionAttributeValueCombination _combination, 
    Name _attributeName = 'BusinessUnit')
    DimensionAttributeLevelValueView valueView;
    DimensionAttribute attribute = DimensionAttribute::findByName(_attributeName); //Retrive attribute record by Name
    select valueView 
        where valueView.ValueCombinationRecId == _combination.recId 
        && valueView.DimensionAttribute == attribute.RecId; //Retrieve individual Dimension attribute record
    return valueView.DisplayValue; //Retrive dimension attribute value

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s