Back in 2013 I wrote a blog post on how to duplicate a company. I basically summarised Microsoft's guide on MSDN. http://dynamicsnavax.blogspot.com.au/2013/07/duplicate-company-in-ax-2012.html
The big issue with those steps are that it is very manual and can scare a lot of people. Imagine having to copy a company set up for 10 plus companies. This can be very tedious and time consuming. Plus there are some references that have to be set up manually like the journal names voucher series. So, why not automate.
I have put my project on codeplex which you can download and use (READ here carefully).
If there are issues importing certain tables it will give you a warning. I would advice to fix these manually.
You can now use Data Import Export Framework to import your customers, vendors and all your master records.
CREDIT - I have taken inspiration from AX2009 copy company class. It does very similar thing of using temp dat/def.
FEEDBACK is appreciated. If you use it in any way, please give me feedback/comments/enhancements.
The big issue with those steps are that it is very manual and can scare a lot of people. Imagine having to copy a company set up for 10 plus companies. This can be very tedious and time consuming. Plus there are some references that have to be set up manually like the journal names voucher series. So, why not automate.
I have put my project on codeplex which you can download and use (READ here carefully).
User guide
- Download the class from https://dax2012copycompany.codeplex.com/ under source codes tab
- Import it into your AOT
- Run the class NAVAX_CopyCompany – Right click Open.
- From company – Enter the from company id
- To company – Enter the new company id (if company doesn’t exit it will create it)
- Use record ID compression – RecIds are recreated and in sequence
- Release products – To release the products into the new company
- Copy worker employment – To copy the employment record to the new company.
If there are issues importing certain tables it will give you a warning. I would advice to fix these manually.
How it works
This works by exporting the dat/def to a temp folder and then creating it in the new company.- Creates the Legal entity
- Copy the ledger set up – this includes the system accounts and account structures
- Copy the company/legal entity specific number sequence – resets the next number to 1. This step does not copy shared number sequence.
- Exports the dat/def for all tables that have the following conditions( Method is copyThisTable()).
- Table group = Group, Reference, Parameter, Miscellaneous, Framework
- Excludes tables that are virtual tables, system tables, temp tables.
- I have manually added these tables PrintMgmtDocInstance and PrintMgmtSettings to include some print management tables. To add more tables that may not have the correct property, just add it to this method copyThisTableMore
- Imports the dat/def into the new created company and deletes the temp file
- Updates the voucher number sequence on the journal names – Ledger journal name, production journal name, inventory journal name. As that is company specific.
- Release products into the new company if the flag is ticked
- Copy worker employment to the new company if the flag is ticked
You can now use Data Import Export Framework to import your customers, vendors and all your master records.
Limitations
- This is class is a duplicate company and works with in the same partition.
- It expects the account structure used in the from and to company are the same. If they are different I would say don’t use it. Just do the company set up manually or use other import methods.
- There maybe other tables that need manual fixing or some coding. For example, I found the Print management setups where not set up. So, I added them to the exception tables list.
CREDIT - I have taken inspiration from AX2009 copy company class. It does very similar thing of using temp dat/def.
FEEDBACK is appreciated. If you use it in any way, please give me feedback/comments/enhancements.