Dynamics 365 Business Central: How to redirects references to table data from one company to another (ChangeCompany Method)

Dynamics 365 Business Central

Hi, Readers.
In this post, I want to discuss how to redirects references to table data from one company to another.
If your client work across different companies in the same Tenant and want to easily collect some data from each company, you may use this method.

Record.ChangeCompany Method:
Syntax:
[Ok := ] Record.ChangeCompany([CompanyName: String])
Parameters:
Record
 Type: Record
An instance of the Record data type.
CompanyName
 Type: String
The name of the company to which you want to change. If you omit this parameter, you change back to the current company.
Return Value:
Ok
 Type: Boolean
true if the operation was successful; otherwise false. If you omit this optional return value and the operation does not execute successfully, a runtime error will occur.

Let me do a simple test.
Show current company name -> Change Company -> Show another company Name.

Test Video:

So by customizing, you can show all company data on the same page, or you can share master data between companies. You can also use the Sales Order data of Company A to create the Purchase Order of Company B, etc.

For example: Try to share customer master data to another company.

Test video:

PS:
You can also use RecordRef.ChangeCompany Method to redirect references to table data from one company to another.

END

Hope this will help.

Thanks for your reading.

ZHU


コメント

タイトルとURLをコピーしました