This post is machine-translated. The original post in german language can be found here.

AX 2012: How to change the value of a default dimension of a record

The following job will give you an example, of how to change the value of a dimension within the default dimensions of a record (the example-job changes the value of the dimension costcenter of a customer). In this way and manner individual dimension values can be removed also.

static void changeDimensionValue(Args _args)
    DimensionAttributeValueSetStorage dimensionAttributeValueSetStorage;
    DimensionAttribute dimensionAttribute;
    CustTable custTable = CustTable::find("US-014");
    DimensionValue oldDimensionValue;
    DimensionValue newDimensionValue = "011";
    DimensionDefault newDimensionDefault;


    DimensionValue getDimensonValue(DimensionDefault _dimensionDefault)
        DefaultDimensionView defaultDimensionView;
        select firstonly DisplayValue
        from defaultDimensionView
        where defaultDimensionView.Name == #dimensionName
            && defaultDimensionView.DefaultDimension == _dimensionDefault;

        return defaultDimensionView.DisplayValue;

    // Get current value
    oldDimensionValue = getDimensonValue(custTable.DefaultDimension);

    // Build DimensionAttributeValueSetStorage
    dimensionAttributeValueSetStorage = DimensionAttributeValueSetStorage::find(custTable.DefaultDimension);
    // Remove old dimension value
    dimensionAttribute = DimensionAttribute::findByName(#dimensionName);
        DimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute, oldDimensionValue).RecId);
    // Set new dimension value
    if(newDimensionValue != "")
        dimensionAttribute = DimensionAttribute::findByName(#dimensionName);
            DimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute, newDimensionValue));
    newDimensionDefault =;

    custTable.DefaultDimension = newDimensionDefault;

Screenshot before job


Screenshot after job


These post applies to following version:
Dynamics AX 2012

Add comment


This post is part of the series »Dynamics AX 2012 - Financial dimensions«

In Dynamics AX 2012, the handling of financial dimensions has changed. Both on the surface and the underlying data model.

In earlier versions you find one field - usually named dimension - of type array. Now you'll find a field derived from RecId called DefaultDimension (or similar).

In this series I want to specifically address these changes and present one or the other piece of code.

Show all posts from this series

RSS-Feed of this blog series


Posts of the actual month
November 2023
© 2006-2023 Heinz Schweda | Imprint | Contact | German version | Mobile version
In order to provide you with better service, this site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.