Register CloneMyCompany

1. Introduction

CloneMyCompany synchronizes Business Central data between a source tenant and a target tenant by detecting populated tables, transferring records in blocks, supporting resumable jobs and optional delta synchronization, and showing the progress on a cockpit page.

2. Requirements and roles

  • Business Central 21.0 or higher, administrative access on both tenants and an Azure AD app registration for OAuth are required before you start.
  • The source tenant (sender) holds the data you want to back up, while the target tenant (receiver) accepts the transferred records via the API endpoints published by the app.

3. Prepare the environment of the target (recipient)

  1. Install the CloneMyCompany app in the target tenant and then assign the necessary permissions to the entry application.

4. Configure the source environment (sender)

  1. Install the app in the source tenant, open CloneMyCompany Setup and select Import connection information to load the JSON that you exported from the recipient. The action validates the JSON format and fills in the authentication fields automatically.
  2. Every time you edit the tenant URL or the credentials, the page deletes the cached OAuth token to make sure that the next request uses the updated values.

4.1 Field reference for CloneMyCompany Setup

Field How to fill it in Why it matters
Target tenant URL Use the base URL of Business Central up to (and including) the environment name, e.g. https://api.businesscentral.dynamics.com/v2.0/<tenantId>/<environmentName>. If the imported JSON ends with /api/, replace this placeholder with the actual environment name before you save. The app appends /api/v2.0/companies when it retrieves companies and /ODataV4/backupdata_ReceiveBackupData for the data transfer. The base URL therefore has to point to the root of the environment and contain the tenant ID that the OAuth handler extracts for token requests.
Client ID / Client secret Take both values from the exported JSON and paste them exactly as given; the secret stays masked in the user interface. They are used for the OAuth token retrieval on every API call; invalid values block communication with the receiver.
Target company Press Refresh Companies to load the list from the target tenant, select the company you want and let the page fill in the field. The selection stores the unique company ID returned by the API and not the display name, so you do not have to enter the name manually. The company ID is appended when the data is sent to the OData endpoint so that the receiver stores the records in the correct company context.
Source company Enter the name of the Business Central company you want to run the job from. Use it as a reminder to run or schedule the job in the context of this company. The engine runs in the current company (or the company set in the job queue entry) without switching automatically. If you match the field to your working company, you avoid errors when you run or schedule backups.
Chunk size Leave it at the default of 1000 records or choose any value between 10 and 10 000, depending on your performance requirements. The chunk size controls how many records the engine bundles per HTTP call when it processes each table.
Enable Delta Sync Switch this option on to skip unchanged records in future runs; leave it off for full backups. When this function is enabled, the app checks the backup log for the last-modified timestamp of each record and only re-transfers new or updated entries.

Once you have filled in the fields, use Test connection to confirm that the credentials and the URL are valid; the action retrieves a new token and reports any authentication error.

5. Select the tables to be transferred

On the setup page, select Select tables to open the table selection list. From there you can:

  • Detect all tables with data automatically (detect tables with data).
  • Toggle the inclusion on or off, adjust the priorities (lower numbers run first) or reset the priorities to the default profile.
  • Select all tables quickly or clear the selection.

The list tracks the number of records and the number of transferred records per table, to make planning large migrations easier for you.

6. Perform backup

  • Start an on-demand transfer with Start backup now; the action is confirmed before the codeunit for the data transfer is called.
  • The backup codeunit validates the registration, initializes the configuration and goes through every selected table, processes the records in chunks and marks the configuration as completed when it is finished.
  • For manual monitoring or to resume an interrupted job, open the CloneMyCompany Cockpit part and use Start/Resume Backup there.

7. Schedule recurring runs

Use Schedule CloneMyCompany on the setup card to define daily, weekly or monthly recurrences. The scheduling page checks your entries, writes the recurrence back to the configuration and creates the corresponding job queue entry. You can update or cancel the schedule from the same page.

The Job Queue Manager runs through the scheduled configurations and triggers StartBackupJob for each one, logging the result of the run so that you can check the automated runs.

8. Monitor progress and keep logs

  • The cockpit shows the overall status, the progress in percent, the estimated remaining time and the timestamp of the last completed backup. Embedded parts show running or failed log entries and detailed table statistics.
  • Clean up historical log entries regularly via Clean Up Log Entries (with predefined retention options) or Delete Backup Log if you need to reset the log completely.
  • The cleanup action is delegated to CleanupBackupLog, which keeps only completed entries that are newer than the selected retention period.

9. Delta-Sync and incremental behavior

When delta synchronization is enabled, ShouldTransferRecord checks the backup log for the timestamp of the last change to each record and skips records that have already been transferred without changes, which reduces repeated traffic.
Even with delta disabled, transfers run in chunks according to the chunk size you have set, so that large tables are processed efficiently.

10. FAQ

What does the URL of the target tenant have to look like?

Use the base URL of the Business Central environment (tenant + environment) without additional API segments, for example https://api.businesscentral.dynamics.com/v2.0/<tenantId>/<environmentName>. The setup page appends /api/v2.0/companies to this base when you refresh companies, and /ODataV4/backupdata_ReceiveBackupData?company=<id> for transfers; the OAuth handler extracts the tenant ID from the same string to request access tokens.

Does "Target company" expect the company name or the ID?

The Update companies action calls the Business Central API, displays the company names and stores the GUID (ID) of the selected company in the configuration. Leave the selection to the action so that the stored ID matches what the APIs expect. Entering a name manually does not work with the OData endpoint.

What should I enter under "Source company"?

Enter the name of the Business Central company you want to back up (for example the company you are currently signed in to). The field documents your intention; the backup engine itself runs in the current company context (or in the company assigned to the job queue entry) and does not switch automatically. Keeping this field correct lets you schedule and run jobs in the right company.

11. Troubleshooting tips

  • Authentication problems - use Check connection to test the credentials immediately. The action reports token errors, so that you can correct the client ID, the secret or the URL.
  • Update error for companies - Make sure that the tenant URL, the client ID and the secret are filled in before you press Update companies. The page shows HTTP status codes if the API request fails, so that you can adjust the URL or the credentials.
  • Log growth - use the log cleanup actions regularly to clear out old completed entries and keep the cockpit responsive.

12. Quick reference

  • Receiver: install app → run Receiver Setup Wizard → export connection JSON.
  • Sender: import JSON → check connection fields → update companies → adjust chunk size/delta synchronization → select tables → run or schedule backup.
  • Monitor: use the cockpit for the status, clean up the logs as needed.
Thomas Marquardt
About the author

Thomas Marquardt

Leads migration projects and is the lead developer of DataMigrate Pro. Over 20 years of Microsoft ERP.