Get Financial Dimensions using X++ - D365 FnO / Ax

 //function which returns the value of given dimension name e.g. BusinessUnit


public str getDimensionDisplayValue(RecId defaultDimension, Name dimName)

{

  DimensionAttributeValueSetStorage dimStorage;


  dimStorage = DimensionAttributeValueSetStorage::find(defaultDimension);

  return dimStorage.getDisplayValueByDimensionAttribute(DimensionAttribute::findByName(dimName).RecId);

}


//DefaultDimension is retrived from PurchTable just to give you an example. You can pass any DefaultDimension value

//'Project' is the name of the financial dimension. You can use 'BusinessUnit', 'Worker' or 'CostCenter' etc.

//call the function follows:


str dimensionValue;

dimensionValue = this.getDimensionDisplayValue(purchTable.DefaultDimension, 'Project')

Comments

Popular posts from this blog

Azure BLOB storage with Dynamics 365 FnO X++

Send Email from Ax / D365 FnO using X++

Import Files from Blob storage using X++ - D365 FnO