Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Can we really delete legal entities from AX 2012 without any issue

Posted on by 10,794 User Group Leader

Hi, Can we really delete legal entities from AX 2012 without facing any data lost or data inconsistency or any major issue in the application. I have imported MS virtual machine demo data and now want to delete unwanted legal entities. Is it really a good practice?

*This post is locked for comments

  • Verified answer
    Faisal Fareed Profile Picture
    Faisal Fareed 10,794 User Group Leader on at
    RE: Can we really delete legal entities from AX 2012 without any issue

    Hi Andrei, Thanks for your suggestion the steps I followed I have documented here on my blog http://daxture.blogspot.ae/2014/09/delete-legal-entities-in-ax-2012.html

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,188 Super User 2024 Season 2 on at
    RE: Can we really delete legal entities from AX 2012 without any issue

    HI Faisal,

    The error occurs when you have ledger transactions in the company. I forgot about that. You can use a class called "SysDatabaseTransDelete" to delete the transactions first.

    Please check if this class contains a method to delete records in the table GeneralJournalEntry and/or GeneralJournalAccountEntry with a filter on the current ledger. I thought some earlier versions did not have this in this class. To run it, you first have to select the company which you need to delete.

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Can we really delete legal entities from AX 2012 without any issue

    Consider first deleting the transaction data in the legal entity

    and then try to delete the legal entity

    please verify and update us with your findings

  • Faisal Fareed Profile Picture
    Faisal Fareed 10,794 User Group Leader on at
    RE: Can we really delete legal entities from AX 2012 without any issue

    Hi Andre,

    I have been trying to delete legal entity "Contoso orange juice" and is having following error. When I checked Ledger table, there is a method AOSValidationDelete which is preventing to delete any legal entity. It seems to me because of data I have in all companies and this table shares data between legal entities.

    Cannot delete a record in Ledger (Ledger).

    The corresponding AOS validation failed.

    Stack trace: Call to TTSCOMMIT without first calling TTSBEGIN.

    Stack trace

    (S)\Classes\xRecord\Delete

    (S)\Data Dictionary\Tables\DirPartyTable\Methods\Delete - line 14

    (S)\Data Dictionary\Tables\DirOrganizationBase\Methods\Delete - line 17

    (S)\Data Dictionary\Tables\CompanyInfo\Methods\Delete - line 31

    (S)\Classes\xRecord\dbOpInTransaction

    (C)\Classes\FormDataSource\delete

    (C)\Classes\FormRun\task

    (C)\Forms\OMLegalEntity\Methods\task

    (C)\Classes\SysSetupFormRun\task

    If I still want to delete a legal entity how can I do without impacting any data lost in these shared tables?

    Can overwriting/commenting the code in these methods have big impacts on application?

    NOTE: I have been trying to delete legal entities from System Administrator.

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,188 Super User 2024 Season 2 on at
    RE: Can we really delete legal entities from AX 2012 without any issue

    Hi Faisal,

    I have deleted some companies in the past and have not seen any problems like data loss in other companies. I would suggest to create a backup of the database before deleting one or more. Then you are able to run to a previous state.

    Note that it is a supported feature to delete companies; otherwise the option was not provided.

    Be sure that you are not restricted by some security policies (eXtensible data security) which could prevent deleting shared table records like the General journal entries. So it would be best to perform this action with the role "System administrator"

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,188 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,030 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans