MergeIt-RecordMergerForDataverse
1.0.0
dotnet add package MergeIt-RecordMergerForDataverse --version 1.0.0
NuGet\Install-Package MergeIt-RecordMergerForDataverse -Version 1.0.0
<PackageReference Include="MergeIt-RecordMergerForDataverse" Version="1.0.0" />
<PackageVersion Include="MergeIt-RecordMergerForDataverse" Version="1.0.0" />
<PackageReference Include="MergeIt-RecordMergerForDataverse" />
paket add MergeIt-RecordMergerForDataverse --version 1.0.0
#r "nuget: MergeIt-RecordMergerForDataverse, 1.0.0"
#:package MergeIt-RecordMergerForDataverse@1.0.0
#addin nuget:?package=MergeIt-RecordMergerForDataverse&version=1.0.0
#tool nuget:?package=MergeIt-RecordMergerForDataverse&version=1.0.0
MergeIt — Record Merger for Dataverse (XrmToolBox plugin)
Merge two active records from the same Dynamics 365 / Dataverse table:
- The Master is kept and receives the selected values from the Slave, field by field.
- The Slave is deactivated after the merge.
MergeIt's three-step workflow: select records, compare fields, and merge.
Two merge modes are available:
| Mode | Behavior |
|---|---|
| Manual (transaction) – all tables | An ExecuteTransactionRequest contains the Master UpdateRequest (changed fields only) and deactivates the Slave (statecode = 1, with statuscode set to the metadata DefaultStatus). Optionally, reassign the Slave's child records (1:N relationships) in the same transaction. The operation is all-or-nothing. |
Native merge (MergeRequest) – account, contact, lead, incident |
Dataverse updates the Master with UpdateContent (built from your choices), reassigns all of the Slave's child records, and deactivates the Slave by linking it to the Master. |
Structure
MergeIt.sln
MergeIt/
MergeIt.csproj SDK-style project, net48; only dependency: XrmToolBoxPackage
RecordMerger.nuspec Package for the XrmToolBox Store (lib\net48\Plugins\)
RecordMergerPlugin.cs MEF entry point (Export IXrmToolBoxPlugin + metadata + icons)
RecordMergerControl.cs UserControl (PluginControlBase): UI only
RecordMergerControl.Designer.cs
PluginSettings.cs Preferences (SettingsManager)
Services/
MetadataService.cs Tables, attributes, relationships, views, default inactive status
RecordService.cs Active record loading / search / views, FetchXML pagination (paging cookie)
MergeService.cs Comparison, merge plan, transaction, MergeRequest, child records
Helpers/
AttributeFilter.cs Field selection rules + system exclusion list (constant)
ValueHelper.cs Human-readable formatting and value comparison
Models/ EntityItem, ViewItem, ComparisonRow, MergePlan, ChildRelationshipInfo…
Forms/ ThemedDialog (base), merge confirmation, Options, Search Fields
Localization/Strings.cs All UI text, in English and French
UI/
Theme.cs Palette, fonts, grid styles, logo
LineIcons.cs Vector icons drawn in code
ThemeRenderer.cs Header (ToolStrip) and menu rendering
Controls/ ModernButton, CardPanel, RoleChip, ChoiceCard, StatTile
Properties/launchSettings.json F5 profile that launches XrmToolBox
The list of excluded system attributes is in Helpers/AttributeFilter.cs (SystemExcludedAttributes). Additional exclusions can be configured in Options without recompiling.
Build
Requirements: Visual Studio 2022 or later (or the .NET 8+ SDK). The .NET Framework 4.8 targeting pack is optional because the project references Microsoft.NETFramework.ReferenceAssemblies.
# Command line
dotnet build MergeIt.sln -c Release
# Or use MSBuild (Visual Studio)
msbuild MergeIt.sln -restore -p:Configuration=Release
Output DLL: MergeIt\bin\Release\net48\MergeIt.RecordMerger.dll.
Dependency note:
XrmToolBoxPackage1.2025.10.74 is compiled againstMscrmTools.Xrm.Connection1.2025.9.64, but declares only version 1.2025.7.63. The csproj therefore pins version 1.2025.9.64; otherwise, the build fails with CS1705. No dependency DLLs are copied to the output (CopyLocalLockFileAssemblies=false); XrmToolBox provides them at runtime.
Test in XrmToolBox
- Close XrmToolBox.
- Copy
MergeIt.RecordMerger.dllto:%AppData%\MscrmTools\XrmToolBox\PluginsCopy-Item .\MergeIt\bin\Release\net48\MergeIt.RecordMerger.dll "$env:APPDATA\MscrmTools\XrmToolBox\Plugins\" - Launch XrmToolBox, open MergeIt from the tools list, and connect to an environment.
Suggested test scenario (development / sandbox environment)
- Create two test accounts, for example, "Test Merge A" (Master) and "Test Merge B" (Slave). Populate different fields, leaving one field empty on A but populated on B. Associate a contact and a task with B.
- In the plugin, select the Account (account) table, enter
Test Merge, and press Enter. - Select A → Set as Master, then B → Set as Slave. The rows are highlighted.
- Click Compare and verify that:
- Rows with different values are highlighted, while identical rows are greyed out.
- The field that is empty on A is preselected from the Slave.
- Selecting the Slave deselects the Master, and vice versa.
- In Manual mode, check Reassign Slave's child records to the Master. Review the listed relationships and their record counts, click Merge, and review the summary.
- In Dataverse, verify that A has the selected values, B is inactive, and the contact and task now reference A.
- Repeat the test with Native merge mode using two other accounts.
- Test failure and atomicity: on the Case (incident) table, use Manual mode, select at least one field from the Slave, and run the merge. Dataverse does not allow a case to be moved to state 1 (Resolved) with a simple Update. The transaction should fail with a clear message, and the Master must remain unchanged.
The confirmation dialog summarizes the changes before they are applied.
The log is available in XrmToolBox via Help › Open Log File (LogInfo / LogError).
Debug
Option 1 – Automatic copy + F5 (recommended)
- In Debug configuration, the MSBuild target
DeployPluginToXrmToolBoxcopies the DLL and PDB to%AppData%\MscrmTools\XrmToolBox\Pluginsafter each build.- If XrmToolBox is running, the DLL is locked and the copy fails with a warning. Close XrmToolBox before building.
- To disable copying:
dotnet build -p:DeployToXrmToolBox=false. To change the destination folder:-p:XrmToolBoxPluginsDir=....
- Edit
MergeIt/Properties/launchSettings.jsonto set the path to yourXrmToolBox.exe(default:C:\XrmToolBox\XrmToolBox.exe). - In Visual Studio, select the XrmToolBox profile and press F5. XrmToolBox starts under the debugger, and plugin breakpoints are hit.
Option 2 – Attach Visual Studio to XrmToolBox
- Build in Debug, then copy both the DLL and PDB to the Plugins folder (Option 1 does this automatically).
- Launch XrmToolBox and open the plugin.
- In Visual Studio, select Debug › Attach to Process… ›
XrmToolBox.exe, with code type Managed (.NET Framework 4.x). - Set breakpoints, for example, in
MergeService.Execute.
Publish to the XrmToolBox Store
- Complete
RecordMerger.nuspec:authors,owners,projectUrl, andiconUrl; then update<Version>in the csproj. - Create the package:
It containsdotnet pack .\MergeIt\MergeIt.csproj -c Release -o .\artifactslib\net48\Plugins\MergeIt.RecordMerger.dlland depends onXrmToolBox1.2025.10.74. Warnings NU5128 and NU5048 (iconUrl) are common for XrmToolBox plugins. - Publish it to nuget.org (
dotnet nuget push), then submit it to the XrmToolBox Store.
Design and language
- No third-party UI libraries. The theme is drawn entirely with GDI+: gradient header, numbered 1-2-3 cards, flat rounded buttons, Master (blue) / Slave (orange) chips, radio buttons in the comparison grid, merge mode choice cards, and statistic tiles. The plugin remains a single DLL, avoiding version conflicts with other plugins and keeping the store package simple.
- The palette and fonts are centralized in
UI/Theme.cs. - Language: English by default. The 🌐 menu in the header switches between English and French. The change takes effect immediately without restarting and is saved in preferences. All UI text is in
Localization/Strings.cs. - In the comparison grid, choose a field's source by clicking the chip or the value itself. Keyboard shortcuts:
Mfor Master,Sfor Slave, andSpacefor the current column.
Features at a glance
- Table: A sorted "Display name (logical_name)" list with a text filter. Only tables that support Advanced Find, are customizable, have
statecode, and are neither intersect nor virtual tables are listed. The last selected table is remembered. - Loading:
- (default load) + Load: loads active records with pagination, up to the limit set in Options (5,000 by default).
- Search: text instantly filters the loaded rows. Press Enter or click Search to run a server-side
like '%text%'search on the primary name and selected search fields (remembered per table). - View: loads the table's system and personal views. FetchXML runs with pagination and is restricted to active records; columns follow the
layoutxml.
- Selection: use the buttons or context menu (right-click), then Swap Master/Slave. A record cannot have both roles.
- Comparison: All from Master / All from Slave (for displayed rows), Show differences only, Hide fields that are empty on both sides, filter by field name, and Include owner (ownerid).
- Options: record limit, "Slave if Master is empty" rule, include
transactioncurrencyid, and additional exclusions.
Known limitations
- Slave deactivation (manual mode): the plugin sets
statecode = 1with the default status. For tables where state 1 is not simply "Inactive" (case = Resolved, lead = Qualified, opportunity = Won, quote, order, etc.), Dataverse requires a dedicated message (CloseIncident,QualifyLead,WinOpportunity, etc.). The transaction then fails without making changes. Use Native merge for cases and leads. - Unsupported fields: images and files (Virtual type), PartyList (
to,from, etc. on activities), calculated and rollup fields, derived attributes, and*_basefields. - Money values: values are copied as-is. If the Master and Slave use different currencies, the amount is interpreted in the Master's currency.
- Child reassignment (manual mode):
- Only 1:N relationships on the primary key are processed. N:N relationships are not reassigned.
- Some system tables are excluded (
activitypointer,activityparty,customeraddress,principalobjectaccess,asyncoperation, etc.). SeeMergeService.ExcludedChildEntities. - Dataverse may reject updates to inactive child records, such as completed activities, causing the entire transaction to fail. Uncheck the affected relationship or use Native merge.
- Above 1,000 operations (the
ExecuteTransactionRequestlimit), reassignments are split across multiple transactions. The final transaction always contains the Master update and Slave deactivation. If a batch fails, earlier batches remain applied. The confirmation dialog warns about this.
- Native merge: requires merge privileges.
PerformParentingChecksis set tofalse. Dataverse reassigns all relationships, with no filtering options. - Search:
like '%text%'does not use indexes and can be slow on large datasets. Entered%,_, and[characters are treated as wildcards. - Views: aggregate views are not supported. Columns from related tables are displayed as
attribute (alias). - Server-side logic: plugins, workflows, business rules, and required-field validation run normally. A merge that clears a required field will fail.
- No undo: test in a development environment first. If enabled, Dataverse auditing records the changes.
Learn more about Target Frameworks and .NET Standard.
-
- XrmToolBox (>= 1.2020.12.43)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 240 | 10/6/2026 |
1.0.0: Initial release. Compare two active Dataverse records field by field, choose which values the Master keeps, then merge with a transaction or use Dataverse's native merge for account, contact, lead, and incident. Optional child-record reassignment is available for manual merges.