Get Financial dimensions for Customer payment journal D365 X++

public   DimensionFinancialTag getDimensionDisplay(LedgerJournalTable _LedgerJournalTable , str DimensionKeyColumnName )
    {
        DimensionAttributeValueSet _DimensionAttributeValueSet;
        DimensionAttributeValueSetItem _DimensionAttributeValueSetItem;
        DimensionAttributeValue _DimensionAttributeValue;
        DimensionFinancialTag _DimensionFinancialTag;
        DimensionAttribute _DimensionAttribute;

        select firstonly _DimensionAttribute where _DimensionAttribute.DimensionKeyColumnName == DimensionKeyColumnName //"Purpose" -"Department"-"Center";

        select _DimensionAttributeValueSet
            where
            _DimensionAttributeValueSet.RecId == _LedgerJournalTable.DefaultDimension

            join _DimensionAttributeValueSetItem
            where
            _DimensionAttributeValueSet.RecId == _DimensionAttributeValueSetItem.DimensionAttributeValueSet

            join _DimensionAttributeValue
            where
            _DimensionAttributeValueSetItem.DimensionAttributeValue ==_DimensionAttributeValue.RecId

            && _DimensionAttributeValue.DimensionAttribute ==_DimensionAttribute.RecId

            join  _DimensionFinancialTag
            where
            _DimensionAttributeValue.EntityInstance ==_DimensionFinancialTag.RecId;

            return _DimensionFinancialTag;

    }

Leave Comment

Your email address will not be published. Required fields are marked *