Register CloneMyCompany
1. Introduction
CloneMyCompany synchronizes Business Central data between a source tenant and a target tenant by detecting populated tables, transferring records in chunks, supporting resumable jobs and optional delta synchronisation, and exposing progress through a cockpit page.
2. Prerequisites and Roles
- Business Central 21.0 or later, plus 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 through the App’s published API endpoints.
3. Prepare the Target (Receiver) Environment
- Install the CloneMyCompany app in the target tenant and assign needed permission to the Entra-Application
4. Configure the Source (Sender) Environment
- Install the app in the source tenant, open CloneMyCompany Setup, and select Import Connection Info to load the JSON you exported from the receiver; the action validates the JSON format and populates the authentication fields automatically.
- Every time you edit the tenant URL or credentials, the page clears the cached OAuth token to make sure the next request uses the updated values.
4.1 Field Reference for CloneMyCompany Setup
| Field | How to fill it | Why it matters |
|---|---|---|
| Target Tenant URL | Use the base Business Central URL 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 that placeholder with the actual environment name before saving. | The app appends /api/v2.0/companies when it retrieves companies and /ODataV4/backupdata_ReceiveBackupData for data transfer, so the base URL must point to the environment root and contain the tenant identifier that the OAuth handler extracts for token requests. |
| Client ID / Client Secret Key | Take both values from the exported JSON and paste them exactly as given; the secret stays masked in the UI. | They are used for OAuth token acquisition on every API call; invalid values block communication with the receiver. |
| Target Company | Press Refresh Companies to load the list from the target tenant, pick the desired company, and let the page populate the field. The selection stores the unique company ID returned by the API rather than the display name, so avoid typing the name manually. | The company ID is appended to the OData endpoint when data is posted, ensuring the receiver stores records in the right company context. |
| Source Company | Enter the Business Central company name you plan to run the job from; use it as a reminder to execute or schedule the job within that company context. | The engine executes in the current company (or the company set on the job queue entry) without switching automatically, so keeping the field aligned with your working company prevents mistakes when you run or schedule backups. |
| Chunk Size | Leave the default 1000 records or choose any value between 10 and 10 000 depending on performance needs. | The chunk size controls how many records the engine bundles per HTTP call while processing each table. |
| Enable Delta Sync | Turn this on to skip unchanged records during future runs; leave it off for full backups. | When enabled, the app checks the backup log for each record’s last modified timestamp and only retransmits new or updated entries. |
After filling the fields, use Verify Connection to confirm that the credentials and URL are valid; the action retrieves a fresh token and reports any authentication error.
5. Select Tables to Transfer
Choose Select Tables in the setup page to open the table selection list. From there you can:
- Detect all tables with data automatically (Detect Tables with Data).
- Toggle inclusion, adjust priorities (lower numbers run first), or reset priorities to the standard profile.
- Quickly select or deselect all tables.
The list tracks record counts and transferred records per table to help you plan large migrations.
6. Run a Backup
- Start an on-demand transfer with Start Backup Now; the action confirms before calling the data transfer codeunit.
- The backup codeunit validates registration, initialises the configuration, and walks every selected table, processing records in chunks and marking the configuration as completed when done.
- For manual monitoring or to resume a suspended job, open the CloneMyCompany Cockpit part and use Start/Resume Backup from there.
7. Schedule Recurring Runs
Use Schedule CloneMyCompany on the setup card to define daily, weekly, or monthly recurrences. The scheduling page validates your input, 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 iterates over scheduled configurations and triggers StartBackupJob for each, logging the runtime outcome so you can audit automated runs.
8. Monitor Progress and Maintain Logs
- The cockpit displays overall status, progress percentages, estimated remaining time, and the timestamp of the last completed backup. Embedded parts show in-progress or failed log entries and detailed table statistics.
- Periodically clean up historical log records via Clean Log Entries (with predefined retention options) or Clear Backup Log if you need to reset the log entirely.
- The cleanup action delegates to
CleanupBackupLog, which keeps only completed entries newer than the selected retention period.
9. Delta Sync and Incremental Behaviour
When delta synchronisation is enabled, ShouldTransferRecord checks the backup log for each record’s last modified timestamp and skips records that were already transferred without changes, reducing repeated traffic.
Even with delta disabled, transfers still run in chunks according to your chunk size, so large tables are processed efficiently.
10. FAQ
How must the Target Tenant URL be structured?
Use the Business Central environment base URL (tenant + environment) without extra API segments, for example https://api.businesscentral.dynamics.com/v2.0/<tenantId>/<environmentName>. The setup page concatenates this base with /api/v2.0/companies when you refresh companies and with /ODataV4/backupdata_ReceiveBackupData?company=<id> during transfers, and the OAuth handler extracts the tenant identifier from the same string to request access tokens.
Does “Target Company” expect the company name or the ID?
The Refresh Companies action calls the Business Central API, displays the company names, and saves the selected company’s GUID (ID) into the configuration. Leave the selection to the action so the stored ID matches what the APIs expect; typing a name manually will not work with the OData endpoint.
What should I enter in “Source Company”?
Enter the Business Central company name you intend to back up (for example, the company you are currently signed into). The field documents your intent; the backup engine itself runs in the current company context (or the company assigned to the job queue entry) and does not switch automatically, so keeping this field accurate helps you schedule and run jobs in the right company.
11. Troubleshooting Tips
- Authentication issues – Use Verify Connection to test credentials immediately; the action reports token errors so you can correct the client ID, secret, or URL.
- Company refresh failures – Make sure the tenant URL, client ID, and secret are filled in before pressing Refresh Companies; the page surfaces HTTP status codes if the API request fails so you can adjust the URL or credentials.
- Log growth – Use the log cleanup actions regularly to purge old completed entries and keep the cockpit responsive.
12. Quick Reference
- Receiver: Install app → run Receiver Setup Wizard → export connection JSON.
- Sender: Import JSON → review connection fields → refresh companies → adjust chunk size/delta sync → select tables → run or schedule backup.
- Monitor: Use the cockpit for status, clean logs as needed.