Managing with Multiple Legal Entity Data in Microsoft Dynamics NAV / Business Central
Well, my client is a Trader of Oils & Fatty Acids and has multiple legal entities to perform various sets of operation on the TRUCK-LOAD(a.k.a. Load). One legal entity creates the Load and schedules it, while another manages with the freight requirements. The information is not shared between both the legal entities. Thus, we need to store the data separately.
Pre-requisites:
For Microsoft Dynamics NAV:
– C/Side Development Environment
– Multiple legal entity(Company) setup
For Microsoft Dynamics Business Central:
– Visual Studio Code
– AL Language Extension
– Multiple legal entity(Company) setup
Solution Design:
1. Create two Tables say LoadCompany1 and LoadCompany2 with same fields
2. Set DataPerCompany property is to TRUE on both the tables.
3. In NAV/ BC, there are common tables but the data into the tables are different. Thus, the system has to manage different version for a single table based on an entity that you’re currently working on.
In this case, I need to set data in different tables and synchronize data between them as shown below.
Code:
1. In this case, to synchronize data, I’ve used TRANFERFIELDS function.
Syntax: DestinationRecord.TRANSFERFIELDS(SourceRecord)
2. To change between working companies for the given table, I’ve used CHANGECOMPANY function.
Syntax: Record.CHANGECOMPANY(CompanyName)
Output:
Inserting Loads
Inserting Loads from Table Company1 Load to Company 2 Load
After processing, the system Inserts the Load from Company 1 to Company 2
Modifying Loads:
There is an existing Load in Company 2
Modifying the Load in Company1 should modify the Load in Company 2 as well
And that’s how I achieved synchronization of data between two companies in Business Central. In the same way, we can also do the same task in NAV as well.
Thanks. Happy weekend 🙂