Showing posts with label Default Dimension. Show all posts
Showing posts with label Default Dimension. Show all posts

Default Dimension D365FO AX-2012


Default Dimension D365FO AX-2012





Following Code will help you to create Default Dimension using X++



Default Dimension Class 


public class DefaultDimesnionHelper
{

    public static DimensionDefault createDefaultDimension(container conAttribute,container attributeValue)
    {
        DimensionAttributeValueSetStorage   valueSetStorage = new DimensionAttributeValueSetStorage();
        DimensionDefault                    result;
  
        int                     i;
        DimensionAttribute      dimensionAttribute;
        DimensionAttributeValue dimensionAttributeValue;
  
        // Note that "Item" is not one of the default dimension,
        // but DimensionAttributeValueSetStorage will handle it gracefully
        container               conAttr = conAttribute;
        container               conValue = attributeValue;
        str                     dimValue;
  
        for (i = 1; i <= conLen(conAttr); i++)
        {
            dimensionAttribute = dimensionAttribute::findByName(conPeek(conAttr,i));
      
            if (dimensionAttribute.RecId == 0)
            {
                continue;
            }
      
            dimValue = conPeek(conValue,i);
      
            if (dimValue != "")
            {
                // The last parameter is "true". A dimensionAttributeValue record will be created if not found.
                dimensionAttributeValue =
                    dimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute,dimValue,false,true);
          
                // Add the dimensionAttibuteValue to the default dimension
                valueSetStorage.addItem(dimensionAttributeValue);
            }
        }
  
        result = valueSetStorage.save();
        return result;
    }


}

Financial dimension configuration for integrating D365FO


Financial dimension configuration for integrating D365FO




Today, A bug reported to me that complete segments Default Dimensions are not exporting using Data Entity...

Functional share more detail with me Like, they set the default dimension with Positions.
Dimension has 9 segments but while they are exporting using data management framework then 5 dimension segments are missing in the Excel sheet.

Entity Name  > Position default dimensions

Here is the screenshot of the position and the set of dimensions.



Dimension set



Functional Create Export Project and Export the data and download the file




downloaded file screenshot





Resolution

After spending hours of hours and debugging in the code, finally, we found that this is a configuration issue and there is a template configuration form available for Dimension Integration..

General Ledger>Chart of accounts>Dimensions>Financial dimension configuration for integrating 

Here We define a segment that we need to export via integration.....

Navigate to Financial Dimension Configuration for Integration





Select Dimension in which you want to change...

Default is 4 Dimension were set in my case and the same was exporting.




Move your required segment from left to right list page.. for demo purposes I have moved all segments.

Save the record a confirmation prompt show on your screen... click on yes.  



Now Execute the Export project and download the export file.




Here is the final result... After changing in 





Dimension configuration working fine for me ...

Please feel free to contact me In case of any issue you are facing during the implementation of this blog


Virtual Fields Vs Computed Fields

  Virtual Field: A virtual field in D365FO is a field that doesn't have a direct representation in the database. It's a field that y...