Transfer Data from One company to Another using ChangeCompany Method:
(1) Sometimes when we implement multiple companies in one database then at that time “ChangeCompany” method is used to transfer data from one company to another.
(2) For Example- there are two companies, user requirement is that when we create a Customer in one company, it will auto-create the same Customer in the second company or vice versa.
(3) To achieve the above requirement, we use “ChangeCompany” method. Syntax of “ChangeCompany” method is:
[Ok := ] Record.ChangeCompany([CompanyName: String]) |
(4) Note: while using the above method, remember the following points:
- User has access rights of both companies, otherwise, system shows error of permission.
- Triggers of tables and fields still run in the current company, not in the company that you specified in the changecomapny method.
- Do not use validate,insert(true) & Modify(true) because it call trigger of current company.
(5) Now see the example in the AL environment.

Development of Trial Balance Report in BC D365 How to attach Report in Page in D365 BC Sales Invoice Report Format and Development in D365 BC Viewing Table Data– Microsoft Docs |