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 :
Finance | Project Operations, Human Resources, ...
Answered

Error while deleting dimension in UAT instance

(0) ShareShare
ReportReport
Posted on by 534

Hi Guys,

I can able to delete the financial dimension through code in the 'dev' instance and it also worked fine in 'UAT' instance also.

but after few days again the deleted dimension came in both the instance Dev and UAT instance, again I try to delete this, but this time it worked fine in the DEV instance but not in the UAT instance I am getting following error.

Getting error in UAT instance while deleting dimension.

 pastedimage1617169722820v1.png

pastedimage1617170113414v2.png

Please help me to solve this.

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    Hi jenifer,

    could you share more information about the business requirement that you are trying to solve? Also, if you get some errors from execution of your code, it might be that your code has some issue. So please check it carefully again. You can of course also share your code if you want some help with it.

    This area is very delicate and risky, so please be extra careful, you could break the financial records of your company (or your customer). The system should allow you to delete dimensions via the UI if it's safe. If the system doesn't allow to do it via UI, I don't recommend to try to work around it via code. You could cause serious issues.

  • Adam123 Profile Picture
    534 on at

    Hi Nikolas,

    My requirement itself deleting 2-3 financial dimension.

    My code is working fine in Dev instance and I have deleted this dimension successfully in the DEV instance.

    when I moved this to UAT it also worked fine and  even I have deleted once, but after few days it again came back to the UAT instance so I again tried to delete but it doesn't worked.

  • nmaenpaa Profile Picture
    101,172 Moderator on at

    Hi jenifer,

    Your latest reply didn't contain any new information, so I don't have anything new to add.

  • Adam123 Profile Picture
    534 on at

    code:

        DimensionAttributeValue dimensionAttributeValue;
        DimensionAttributeSetItem  dimensionAttributeSetItem;
        DimensionAttribute dimensionattribute;
        DimensionAttributeValueCombination dimensionAttributeValueCombination;
        DimensionAttributeValueGroup dimensionAttributeValueGroup;
        DimensionAttributeValueGroupCombination dimensionAttributeValueGroupCombination;
        DimensionAttributeLevelValue dimensionAttributeLevelValue;
        int64 DimensionAttributeRecid;
        str FinancialDimensionName = "DONOTUSE1";
    
        select dimensionattribute where dimensionattribute.DimensionKeyColumnName == FinancialDimensionName
               DimensionAttributeRecid = dimensionattribute.RecId;
    
        // To delete related records in dimensionAttributeValueCombination
        delete_from dimensionAttributeValueCombination where dimensionAttributeValueCombination.RecId == DimensionAttributeRecid;
    
        // To delete related records in dimensionAttributeValueGroup
        delete_from dimensionAttributeValueGroup where dimensionAttributeValueGroup.RecId == DimensionAttributeRecid;
    
        // To delete related records in dimensionAttributeValueGroupCombination
        delete_from dimensionAttributeValueGroupCombination where dimensionAttributeValueGroupCombination.DimensionAttributeValueGroup == DimensionAttributeRecid;
    
        // To delete related records in dimensionAttributeLevelValue
        delete_from dimensionAttributeLevelValue where dimensionAttributeLevelValue.DimensionAttributeValueGroup == DimensionAttributeRecid;
    
        // To delete related records in dimensionAttributeValue
        delete_from dimensionAttributeValue where dimensionAttributeValue.DimensionAttribute == DimensionAttributeRecid;
    
        // To delete related records in dimensionAttributeSetItem
        delete_from dimensionAttributeSetItem where dimensionAttributeSetItem.DimensionAttribute == DimensionAttributeRecid;
    
        // To delete related records in dimensionAttribute
        delete_from dimensionattribute where dimensionattribute.DimensionKeyColumnName == FinancialDimensionName;
    
        Info(strFmt("%1","Deletion Completed for DONOTUSE1"));

  • Suggested answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    Hi jenifer,

    when you share code, please click "Use rich text formatting" -> "Insert" -> "Insert code" so that it's easier to read. This time I did it for you.

    I still don't understand why you have developed this code, I would really like to know the business requirement.

    My strong suggestion is to delete dimensions only via the UI. Could you please try that, and see if it solves your business requirement? If it doesn't solve your business requirement, please consider if you could share the requirement with us. Until that I'm unable to provide any more inputs.

    Thanks!

  • Adam123 Profile Picture
    534 on at

    There are 2-3 financial dimension are unused , for that purpose we are trying to delete it

    When I try to delete this through form I get the error as:

    pastedimage1617175826524v1.png

  • Verified answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    Hi jenifer,

    the error message says that the dimension is used on a transaction. You can't delete financial dimensions that are used on transactions. This would break your historical ledger data. If you discuss this with your financial department and financial auditors, I'm quite sure that you and they will eventually agree that it should not be deleted.

  • Verified answer
    AshokKumarGuptaEga Profile Picture
    Microsoft Employee on at

    Dear Jenifer,

    Microsoft doesn't recommend or allow to delete financial dimension from back end or from UI.  On top those dimensions has some posted transactions as well.  As explained by Nikolaos if you attempt to delete it will break your historical data.  Hence deletion of financial dimension in blocked by MS intentionally.  Instead of deletion you can consider to deactivate or put an end date from dimension value form.

    Best Regards

    Ashok Kumar Gupta Ega

    Sr. T.A, Microsoft.

  • Verified answer
    André Arnaud de Calavon Profile Picture
    305,007 Super User 2026 Season 1 on at

    Hi Jenifer,

    Did you follow the link in the SQL error? This brings to to the next page: Prepare for dimension table changes in Financial Dimension Framework - Microsoft Dynamics 365 Blog

    As of December 1, 2020 deleting records directly has been blocked for the reasons provided in the blog.

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 April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 677 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 620

#3
Subra Profile Picture

Subra 483

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans