X++ code to get Financial Dimensions in D365FO


  public void getFinancialDimensions()
    {

       DimensionAttributeValueSet  dimAttrValueSet;
        DimensionAttributeValueSetItem  dimAttrValueSetItem;
        DimensionAttributeValue     dimAttrValue;
        DimensionAttribute          dimAttribute;
        LedgerJournalTable          ledgerJourTable;
        VendTable                   vendTable;
        CustTable                   custTable;
     
        ledgerJourTable = LedgerJournalTable::find('');//JournalNum

        vendTable = VendTable::find('');//AccountNum
        custTable = CustTable::find('');//AccountNum

        //ledgerJourTable.DefaultDimension,vendTable.DefaultDimension,custTable.DefaultDimension
        //Provide default dimension as below

        dimAttrValueSet = DimensionAttributeValueSet::find(ledgerJourTable.DefaultDimension);

        while select * from dimAttrValueSetItem where  dimAttrValueSetItem.DimensionAttributeValueSet == dimAttrValueSet.RecId
             join dimAttrValue  where dimAttrValue.RecId == dimAttrValueSetItem.DimensionAttributeValue
             join dimAttribute where dimAttribute.RecId ==dimAttrValue.DimensionAttribute
        {
            info(strFmt("DimName:%1---------Dim Value:%2",dimAttribute.Name,dimAttrValueSetItem.DisplayValue));
        }
}

Comments

Popular posts from this blog

x++ code to add hyperlink to a field in D365FO

x++ code to get Vendor Email Address based on Purpose in Dynamics 365 for Operations

x++ code to get Customer Address based on purpose in ax 2012