<turbo-stream action="update" target="wiki_card"><template>

<h1>D365 Sales: Duplicate Detection Errors During Integration</h1>
<div class="trix-content"><p>When syncing records from an external system (such as NAV, Business Central, Salesforce, or HubSpot) into Dynamics 365 Sales, you may encounter errors that prevent records from being created. One of the most common causes is Duplicate Detection - a built-in D365 Sales feature designed to prevent the same record from being entered twice.</p><p>While duplicate detection is useful for maintaining data quality, it can cause integration failures when legitimate records are incorrectly flagged as duplicates. This article explains how duplicate detection works, which record types are affected, and how to resolve the issue.</p><h2>The Error</h2><p>The integration will log an error similar to the following:</p><pre>E2180 - ECE_RestFaultResponse: Status 400 Bad Request — "An account with the same name or account number already exists in the system." (0x80040265)</pre><p><br>This error is returned by D365 Sales - not the source system - and it means the record was rejected before it was created.</p><h2>How Duplicate Detection Works</h2><p><br></p><p>Duplicate Detection Rules in D365 Sales define which fields are checked when a new record is created or updated. If an incoming record matches an existing one based on those fields, D365 blocks the operation and returns the error above.</p><p>Rules can be configured with AND or OR logic between conditions:</p><p>•&nbsp; &nbsp; &nbsp; &nbsp;OR logic — blocks the record if any one of the conditions matches (e.g. same name OR same number). This is the default and the most common cause of false positives.</p><p>•&nbsp; &nbsp; &nbsp; &nbsp;AND logic — only blocks the record if all conditions match simultaneously (e.g. same name AND same number). This is more precise and recommended for integrations.</p><h2>Root Cause</h2><p>The most common root cause is the OR logic in the duplicate detection rule combined with data that is legitimately repeated across entities or regions. For example:</p><p>•&nbsp; &nbsp; &nbsp; &nbsp;A company called "Acme Corp" exists in both the US and MX entities in NAV/BC with different customer numbers. D365 blocks the second one because the name matches, even though the account number is unique.</p><p>•&nbsp; &nbsp; &nbsp; &nbsp;A contact with a shared corporate email address (e.g. info@company.com) is associated with two different companies. D365 blocks the second contact because the email matches.<br><br></p><h2>Fix Options</h2><p>There are three ways to resolve this issue, depending on your situation:</p><p>&nbsp;</p><p><strong>Option 1 — Change OR to AND in the Duplicate Detection Rule (Recommended)</strong></p><p>This is the cleanest and most sustainable fix. Update the rule so that it only blocks a record when all conditions match — meaning it is a true duplicate, not just a partial match.</p><p><br></p><p>When to use this option:</p><p>•&nbsp; &nbsp; &nbsp; &nbsp;You have multiple source entities or regions that can legitimately share names or email addresses.</p><p>•&nbsp; &nbsp; &nbsp; &nbsp;Your source system has a reliable unique identifier (e.g. customer number, account number) that distinguishes records.<br><br>How to apply:</p><p>1.&nbsp; &nbsp; &nbsp;In D365 Sales, go to the gear icon → Advanced Settings.</p><p>2.&nbsp; &nbsp; &nbsp;Navigate to Settings → Data Management → Duplicate Detection Rules.</p><p>3.&nbsp; &nbsp; &nbsp;Find and open the rule for the affected record type (Account, Contact, or Lead).</p><p>4.&nbsp; &nbsp; &nbsp;Click Deactivate — the rule must be inactive to edit it.</p><p>5.&nbsp; &nbsp; &nbsp;Change the condition logic from OR to AND between the name/email and number/ID fields.</p><p>Click Save, then Publish to reactivate the rule.<br><br><strong>Option 2 — Deactivate the Duplicate Detection Rule Entirely</strong></p><p>If duplicate detection is not required for a specific entity in your D365 environment, the rule can simply be deactivated.</p><p>&nbsp;</p><p>When to use this option:</p><p>•&nbsp; &nbsp; &nbsp; &nbsp;Duplicate detection for this entity is not a business requirement</p><p>•&nbsp; &nbsp; &nbsp; &nbsp;Data governance is handled entirely by the source ERP system<br><br></p><h2>After Applying the Fix</h2><p>Once the duplicate detection rule has been updated or suppressed, re-run the failed integration transfer. The previously rejected records should now be created successfully in D365 Sales.</p></div>
</template></turbo-stream>

