June 18, 2020

    How to Share Data Through Legal Entities in Dynamics AX 2012 and D365

    When working in Microsoft Dynamics AX, many tables are specified as company specific. That means data should be entered separately for each legal entity so users can only access the data in the current company. 

    If you are using more than one legal entity, it might be useful to share data from standard or new custom tables with general information.

    What’s more, several things have changed from Dynamics AX 2012 to Dynamics 365 (D365). This blog will cover the basics for getting started using the data sharing feature in both versions, with a short guide on how to set it up. You’ll learn how to share data from one or more legal entities, and what issues to look out for.

    Working in Dynamics AX 2012

    How to share data from a table across all companies

    The most straightforward way to share data from a table across all companies is to set the table property Save Data Per Company to No. This will merge data for the table and make the data accessible from all companies. In practice, the kernel will delete the system field DataAreaId for the table.

    In most cases, you should use that property, but in some cases, when you need more flexibility with data you share, there is one more way to achieve this. The main advantage of this feature is that you can specify a set of companies that will share data you need. In D365, you can even select which fields will be shared.

    Using table connections in Dynamics AX 2012

    Another way to share data in AX 2012 without having to change any settings in the existing tables is by creating a virtual company and storing data there. Normal companies are configured to read and write data from this virtual company. The only purpose of a virtual company is to share data across companies, you cannot log into this virtual company.

    This can be done by using table collections. Table collection is used to set up virtual companies and to share the same data across the companies which are added to the virtual companies list. The table collections are maintained in the Application Object Tree (AOT) and contain the tables being shared.

    Note: All the companies share this data in AX. This option will delete the DataAreaId field and default (DataAreaId, RecId) index from the table. If you want more control over shared data, like which companies can share and which cannot, then use a virtual company.

    When you create a virtual company account, you specify a collection of tables that is shared among a group of companies. (Don't forget to include other related tables that need to be virtualized along with it). When users save information in one of those tables, the data is not copied. Still, there is one record with the ID of the virtual company as DataAreaId. The data is directly visible in the other companies.

    Proceed with caution when creating virtual companies in AX 2012

    Virtual companies should be used with caution. Once you have started processing transactions in a production environment, undoing virtual companies can be very difficult.

    Here are some recommendations and tips on how to use them:

    • Do not include tables in a virtual company which are not company-specific.
    • You should have only one Application Object Server (AOS) working when a virtual legal entity is created. All other AOS instances should be off.
    • When you set up a new virtual company, know that AX does not move data automatically from normal company; you have to do it manually.
    • De-virtualization will not create a copy of the data in each company. Instead, the table records are disassociated with the virtual company, and you will not see the records on a form, but records are still available in the database.
    • Do a backup of your data before adding or deleting the table from the virtual company. When you delete a virtual company, the shared data that is associated with the virtual company is not deleted automatically. To delete a virtual company, you must remove the associated data from the tables that were shared via the virtual company.

    Working in Dynamics 365

    What’s changed in D365?

    With the new Dynamics 365 for Finance and Operations, Microsoft has presented "cross-company data sharing." This is similar to the virtual company idea that Dynamics AX 2012 had, aside from the need to create a virtual company and with the feature of choosing which fields can be shared.

    So, what is cross-company data sharing in Dynamics 365?

    Essentially, this gives you the ability to share a table at any time you want, and it will replicate the data to the companies that you want and keep the fields in sync if you make changes in any company.

    Unlike virtual companies in AX 2012, cross-company data sharing in D365 replicates the data automatically. So, when a new record was added, it would only add one record with the virtual company DataAreaId, and the companies you added to this virtual company would lookup data using the virtual company DataAreaId rather than the company's DataAreaId.

    There are some limitations to using this new feature:

    • It can’t be used to share transactional data between companies.Only tables with property Table Group Reference and Group data can be shared.It supports the replication of less than one million total records per job. Only one level of child relationships is exposed. To ensure data consistency, replication doesn't happen if another level is required.

    To identify if the table can be shared, follow these steps:

    1) Check Table Group property on tables. If its Reference or Group, then it can be shared.

    Table Group property

    2) Try using the Chrome Extension, "Table Browser Caller for D365FO," where you can see a list of tables and their properties.

    Table Browser Caller for D365FO

     

    Sharing data in D365

    1) Go to the System administration > Setup > Configure cross-company data sharing. Create a new record and save it.

    2) Click on Add button. If the table has another table group which is not Reference or Group you will not be able to add this table and the warning message will be shown, as this is one of the limitations.

    Sharing data in D365 fig 1

    3) If this happens, proceed with another table. For example, choose Category Table and click Add table. Now, you can see the table is added. If you expand it, it would have all the fields that the table has. You can choose which fields to be shared. You don’t have to share all the data if you don’t want to.

    Sharing data in D365 fig 2

    4) After the table and the required fields have been added, you can then proceed and tell the system what companies we will share the data among. To do that, just click on the Add (+) button in the companies panel to create a new record.

    Sharing data in D365 fig 3

    This is a huge benefit for customers as this reduces the overhead of maintaining the same data in several different legal entities.

    5) To activate sharing, click the Enable button in the action pane.

    Sharing data in D365 fig 4

    You will be prompted to confirm copying all the data across all shared companies. Click Yes.

    Sharing data in D365 fig 5

    The data sharing feature copies the records to each legal entity. It does not create a separate legal entity for sharing like the old virtual company feature did. In case of any data issues during copying, you may find all conflicts under the “find sharing issues” button. There you can also find any conflicts that happened during validations and decide which value should be overwritten.

    6) Check your data and test how it works.

    Now, if you insert, update or delete records in a table and in a company that is set up as shared, the update of table data immediately applies to all shared companies.

    Sometimes after sharing some tables, you realize that some of this data don't have to be shared, and it's necessary to unshare the tables. You can disable this sharing policy and the shared data will remain in each company, but any new inserts or edits will not be shared.

    To check if all is working as expected, add a new category and save it. You might face an error that reads “Cannot create a record in Category table.” :

    Sharing data in D365 fig 6

    This happens when the category is presented in the category table, but not shown in the form since the linked ProjCategory table is not shared, thus not copied to the company we are working on and does not exist in USMF. To fix this, go back and add ProjCategory to the cross-company data sharing form.

    This is a common issue you might also face in production when one or more related tables are not shared with the main table. You might not notice this issue if the data in all companies you shared are the same in all shared tables. However, you might get this error if you try to share your data with the new legal entity you created.

    When getting started with data sharing features in AX 2012 or Dynamics 365, try it first with some dummy data in a test environment so you won’t lose your data or accidentally break the production.

    We reviewed a lot of information in this post and hopefully you found these specific steps helpful for AX or D365. If you should need further guidance or have questions, feel free to contact our team of Dynamics experts.

    About the Author

    Oleh ShulezhkoOleh Shulezhko - Software Development Engineer for Enavate

    Oleh is a Software Development Engineer for Enavate. His primary focus is development, customization and maintenance of software products. He is also involved in understanding and analyzing the needs of the customer and providing a solution that will solve a problem to make life easier for the end users.

    Oleh Shulezhko

    Oleh is a Software Development Engineer for Enavate. His primary focus is development, customization and maintenance of software products. He is also involved in understanding and analyzing the needs of the customer and providing a solution that will solve a problem to make life easier for the end users.

    Enavate Recent Posts

    March 27, 2024

    The Costs and Benefits of Microsoft Dynamics 365 Business Central

    Microsoft Dynamics 365 Business Central is an agile ERP platform that allows small to medium-sized businesses (SMB) to enhance, grow, and scale their operations, allowing for... Read More
    March 15, 2024

    How to Reduce Warehouse Management Costs with Automation

    Way back in 2015, Supply Chain Management Review claimed that warehouse automation is one of the few remaining areas where companies can still significantly reduce their... Read More
    March 13, 2024

    How Business Central Helps You Stay on Task

    Anyone who has ever traveled by plane knows how stressful it can be to have a connecting flight. You must wait your turn to get off the first plane, figure out where your... Read More

    Subscribe to Receive Email Updates