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
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
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.
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
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.
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"
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,188 Super User 2024 Season 2
Martin Dráb 230,030 Most Valuable Professional
nmaenpaa 101,156