≡ Menu




Getting All Active financial dimensions in D365 for Finance and operations (AX 7)

Testing the old code in Dynamics 365 for Finance and operations. It works fine. If you try to get all active financial dimension in D365 for Finance and operations following code snippet works perfectly fine.

class TestReadFinanicalDimension
{
///

/// Runs the class with the specified arguments.
///

/// The specified arguments. public static void main(Args _args)
{
DimensionAttributeSetItem dimAttrItemSet;
DimensionAttribute dimAttrList;
DimensionEnumeration dimensionSetId;

int dimAttrCount;

dimensionSetId = DimensionCache::getDimensionAttributeSetForLedger();

select count(RecId) from dimAttr
where dimAttr.Type != DimensionAttributeType::MainAccount
join RecId from dimAttrSetItem
where dimAttrSetItem.DimensionAttribute == dimAttr.RecId &&
dimAttrSetItem.DimensionAttributeSet == dimensionSetId;

info(strFmt(“Total active financial dimensions for current legal entity: %1”, dimAttr.RecId));

while select * from dimAttr
order by Name
where dimAttr.Type != DimensionAttributeType::MainAccount
join RecId from dimAttrSetItem
where dimAttrSetItem.DimensionAttribute == dimAttr.RecId &&
dimAttrSetItem.DimensionAttributeSet == dimensionSetId
{
info(dimAttr.Name);
}

}

}

Output is


Reference: https://sumitsaxfactor.wordpress.com/2011/12/14/find-active-dimensions-for-a-legal-entity-ax2012/

{ 0 comments… add one }

Leave a Comment