Thursday, December 31, 2020

Get financial dimension display value using x++

 Code to get dimension display value in ax 2012/D365 FO using x++ 


public str getDimensionDisplayValue(RecId _defaultDimension, Name dimName)
{
  DimensionAttributeValueSetStorage dimStorage;

  dimStorage = DimensionAttributeValueSetStorage::find(_defaultDimension);
  return dimStorage.getDisplayValueByDimensionAttribute(DimensionAttribute::findByName(dimName).RecId);
}
str dimensionValue;
dimensionValue = this.getDimensionDisplayValue(DefaultDimensionRecId, 'Project');

//Where
//defaultDimensionRecId can be PurchTable.Defaultdimension, InventTable.DefaultDimension etc
//'Project' is the name of the financial dimension. It can be 'BusinessUnit' 'CostCenter' etc.


Note: Please refer to the tables below to get display value name.
1. DimensionfinancialTagCtegory
2. OmoperatingUnit (OMOperatingUnitNumber, OMOperatingUnitType)


No comments:

Post a Comment