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)

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

(0) ShareShare
ReportReport
Posted on by 10,796 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

I have the same question (0)
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    300,731 Super User 2025 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"

  • Faisal Fareed Profile Picture
    10,796 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.

  • Verified answer
    Community Member Profile Picture
    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

  • André Arnaud de Calavon Profile Picture
    300,731 Super User 2025 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
    Faisal Fareed Profile Picture
    10,796 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

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 3

#3
Scott_itD Profile Picture

Scott_itD 2 Community Manager

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans