Thursday, 6 June 2024

Dynamics extension is not visible for VS 2019/2022

 1.  Navigate to K:\DeployablePackages\<Guid>(latest date time)\DevToolsService\Scripts.

2.  Locate a file "Microsoft.Dynamics.Framework.Tools.Installer.vsix" and double click it . (It will be an application )
3.  Make sure Visual Studio 2017/2019 checkbox is selected, complete the process.
4.  Restart the dev environment.

Friday, 15 September 2023

Create financial dimension with costcenter(Department, unit…etc):

 Create financial dimension with costcenter(Department, unit…etc): 

Ex: Costcenter financial dimension creation 

public static DimensionDefault createDerivedDimension(String20 _costCenter)

    {

        DimensionAttributeValue dimAttrValue;

        DimensionAttribute      dimAttr;

        str                     dimAttrCCValue;

        DimensionDefault        result;

        boolean                 isDerivedDimension;

                            

        dimAttrCCValue          = _costCenter;

        

        dimAttr                 = DimensionAttribute::findByName("@CCB:Costcenter");

        dimAttrValue            = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAttr, dimAttrCCValue, false, true);

                        

        DimensionAttributeValueDerivedDimensions    derivedDim = DimensionAttributeValueDerivedDimensions::findByDimensionAttributeValue(dimAttrValue.DimensionAttribute, dimAttrValue.RecId);

        DimensionAttributeValueSetStorage           defaultDimStorage = new DimensionAttributeValueSetStorage();

        DimensionHierarchy                          dimHierarchy = DimensionAttributeDerivedDimensions::findDimensionHierarchyForDrivingDimension(DimensionAttribute::find(derivedDim.DimensionAttribute));

        DimensionHierarchyLevel                     dimHierarchyLevel;

        DimensionAttributeDerivedDimensions         derivedDimensions;


        while select RecId, DimensionAttribute from dimHierarchyLevel

                                where dimHierarchyLevel.DimensionHierarchy == dimHierarchy.RecId

                                    join DerivedDimensionFieldNum from derivedDimensions

                                        where derivedDimensions.DimensionHierarchyLevel == dimHierarchyLevel.RecId

        {

            DimensionAttributeValueRecId    davRecId = derivedDim.(derivedDimensions.DerivedDimensionFieldNum);

            DimensionAttributeValue         dav = DimensionAttributeValue::find(davRecId);


            defaultDimStorage.addItemValues(dimHierarchyLevel.DimensionAttribute, dav.RecId, dav.HashKey);

            isDerivedDimension = true;

        }


        // If there is no derived dimension available then at-least create the default dimension with Cost Centre Value only.

        if (!isDerivedDimension)

        {

            defaultDimStorage.addItem(dimAttrValue);

        }


        result = defaultDimStorage.save();

        return result;

    }