Sunday, June 23, 2019

How to create a Dimension Value using x++ D365 FO

There are lot of tables holding values for Financial Dimensions such as DimensionAttributeValue and DimensionAttributeValueCombination but in case if we can't find the values in these above tables then we have another table known as DimensionFinancialTag through which we can get values as well as we can create new dimensions as well.


Here is an example mentioned below :-

        
 DimDetails                                          dimensiondetails;
 DimensionAttribute                             dimAttr;
 DimensionAttributeValue                    dimAttrValue;
 DimensionDefault                                result;
 DimensionFinancialTag                       dimFinTag , dimFinTagval;
 RecId                                                    dimFinancialCategoryRecid;
        
DimensionAttributeValueSetStorage   valueSetStorage = new 

DimensionAttributeValueSetStorage();

        try
        {
        dimAttr = DimensionAttribute::findByName('ABC');
        dimFinancialCategoryRecid = dimAttr.financialTagCategory();
        while select dimensiondetails where dimensiondetails.UpdateFlag==0
        {
            select dimFinTag where
                   dimFinTag.FinancialTagCategory == dimFinancialCategoryRecid &&
                   dimFinTag.Value == dimensiondetails.AssetCode;

            if(!dimFinTag.RecId)
            {
                dimFinTagval.Value = dimensiondetails.AssetCode;
                dimFinTagval.Description = dimensiondetails.AssetDescription;
                dimFinTagval.FinancialTagCategory = dimFinancialCategoryRecid;
                dimFinTagval.insert();
                
            }

            
        }

        }

        catch(Exception::Error)
        {
            ttsAbort;
            throw Exception::Error;
        }

No comments:

Post a Comment

Performance Tuning in D365 Finance & Operations — A Deep Dive from the Field

Patterns, Pitfalls, and Proven X++ Techniques for Enterprise-Scale Systems Performance problems in Dynamics 365 Finance & Operations ra...