web
You’re offline. This is a read only version of the page.
close
Skip to main content
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)
  • Verified answer
    AXTechie2120 Profile Picture
    568 on at
    RE: Dimension values update in ax 2012

    Yes! I got that.

    I solved that.

    Thanks for the answer

  • Verified answer
    udaY-ch Profile Picture
    5,084 on at
    RE: Dimension values update in ax 2012

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

  • AXTechie2120 Profile Picture
    568 on at
    RE: Dimension values update in ax 2012

    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

  • AXTechie2120 Profile Picture
    568 on at
    RE: Dimension values update in ax 2012

    The error that i am getting is

    invalid baseenumtype : 2

  • udaY-ch Profile Picture
    5,084 on at
    RE: Dimension values update in ax 2012

    What is the error message you get on the line

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

  • AXTechie2120 Profile Picture
    568 on at
    RE: Dimension values update in ax 2012

    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,084 on at
    RE: Dimension values update in ax 2012

    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.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Mea_ Profile Picture

Mea_ 4

#3
KP-31070522-0 Profile Picture

KP-31070522-0 3

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans