web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Dimension values update in ax 2012

(0) ShareShare
ReportReport
Posted on by 568

Hi guys,

I have been trying to update the dimension values for my customers, But I am unable to do this because of some error in my code.

The error that I am getting is invalid baseenumtype.

I have tried to debug, but I can't able to find a solution to this problem.

I am getting an error on this line.

 dimesiondefault = AxdDimensionUtil::getDimensionAttributeSetId(defdimensioncon);

static void dimensionreplacement_BK(Args _args)
{
    CustTable     custtable = CustTable::find("US-004");
    Struct    struct = new Struct();
    container    defdimensioncon;

    DimensionDefault     dimesiondefault;

    DimensionAttributeSetItem   dimattrsetitem;

    DimensionAttribute          dimattribute;
    DimAttributeOMBusinessUnit   ombussinessunit;
    int i;

   while select forUpdate Name,BackingEntityType from dimattribute
          where  dimattribute.BackingEntityType ==
    tableNum(DimAttributeOMBusinessUnit)||
                dimattribute.BackingEntityType ==
    tableNum(DimAttributeOMDepartment)||
                dimattribute.BackingEntityType   ==
    tableNum(DimAttributeHcmWorker)
       &&
         dimattribute.Type   != DimensionAttributeType::DynamicAccount
                    join   dimattrsetitem
                        where   dimattrsetitem.DimensionAttribute == dimattribute.RecId
        &&
                dimattrsetitem.DimensionAttributeSet ==
            DimensionCache::getDimensionAttributeSetForLedger()
    {
        if(dimattribute.BackingEntityType == tableNum(DimAttributeOMBusinessUnit))
        {
            struct.add(dimattribute.Name,'BU-002');
        }
        else if(dimattribute.BackingEntityType == tableNum(DimAttributeOMDepartment))
        {
            struct.add(dimattribute.Name,'DEP-002');
        }
        else if(dimattribute.BackingEntityType == tableNum(DimAttributeHcmWorker))
        {
            struct.add(dimattribute.Name,'114');
        }

}

    defdimensioncon += struct.fields();
    for(i=1 ; i<= struct.fields();i++)
    {
        defdimensioncon += struct.fieldname(i);
        defdimensioncon += struct.valueindex(i);
    }


    if(struct.fields())
    {
        dimesiondefault = AxdDimensionUtil::getDimensionAttributeSetId(defdimensioncon);


        ttsBegin;
        custtable.DefaultDimension = DimensionDefaultingService::serviceMergeDefaultDimensions(dimesiondefault,custtable.defaultdimension);

    }
    else
    {

        custtable.DefaultDimension = dimesiondefault;

    }

    custtable.doUpdate();
    ttsCommit;
}


Please advise.

Regards,

AxTechie2120

*This post is locked for comments

I have the same question (0)
  • udaY-ch Profile Picture
    5,175 on at

    Hi,

    Follow the link and add the respective array of dimension required in your scenario

    https://community.dynamics.com/ax/b/amirsaxspace/archive/2012/10/08/job-to-update-customer-financial-dimension-in-dynamics-ax-2012

    /Uday.

  • AXTechie2120 Profile Picture
    568 on at

    Hi,

    I just want to replace the existing dimension value for the customer,your link was useful but i want to know why the error is throwing in my code.

    Please help on that.

  • udaY-ch Profile Picture
    5,175 on at

    What is the error message you get on the line

    "dimesiondefault = AxdDimensionUtil::getDimensionAttributeSetId(defdimensioncon);"

  • AXTechie2120 Profile Picture
    568 on at

    The error that i am getting is

    invalid baseenumtype : 2

  • AXTechie2120 Profile Picture
    568 on at

    Sorry to trobule you guys,

    I have called the wrong method in that line and thats the error causing me .

    Anyway thanks for your time and help.

    Regards,

    AXTechie

  • Verified answer
    udaY-ch Profile Picture
    5,175 on at

    You should be using AxdDimensionUtil::getDimensionAttributeValueSetId instead of AxdDimensionUtil::getDimensionAttributeSetId

  • Verified answer
    AXTechie2120 Profile Picture
    568 on at

    Yes! I got that.

    I solved that.

    Thanks for the answer

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 39

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans