Setting up a cross-entity duplicate detection rule
Here's how to configure a rule that compares two different entities, using a Lead-to-Contact email match as the example.
1. Open duplicate detection rules
Go to your Dynamics 365 Sales (or other model-driven) app. Open Advanced Settings, then go to Settings > Data Management > Duplicate Detection Rules. In some environments this sits under the classic settings area instead, at the same path.
2. Create a new rule
Click New and name the rule something specific, like "Lead to Contact - Email Match."
3. Set Base and Matching Record Types
Set Base Record Type to the entity you want to check, Lead in this example. Set Matching Record Type to the entity you want to compare against, Contact. The Rule Criteria area below is where you define which fields from each entity get compared.
4. Define the matching criteria
For a Lead-to-Contact email match:
- Base Record Field: the Lead's primary email field (Email).
- Matching Record Field: the Contact's primary email field (Email or Email Address 1).
- Operator: Exact Match.
You can add multiple criteria lines. Within one rule, they're combined with AND: every condition must be true for a record to count as a duplicate. For OR-type behavior, you need separate rules, one per pattern.
5. Configure additional settings
Three settings are worth knowing:
- Exclude inactive matching records, if you only want to check against active records in the matching entity.
- Case sensitive, if [email protected] and [email protected] should count as different values.
- Ignore blank values, so empty fields don't get flagged as matches.
6. Save and publish
Click Save and Close, then select the new rule and click Publish. A rule that isn't published doesn't run. Publishing generates the internal matchcodes Dynamics 365 uses to compare existing records, which can take noticeable time in larger environments.
Handling custom tables
Custom tables work the same way as standard entities, with one extra step first: open Power Apps, go to the custom table, click Edit table properties, and under Advanced options check Duplicate detection. Once that's on, you create rules for the custom table exactly as you would for Contacts or Leads. Within-entity and standard rule-based matching both work.
When duplicate detection actually runs
Dynamics 365 doesn't check for duplicates in every scenario.
It runs during manual record creation or updates in the UI, Outlook offline-to-online sync, and data imports if duplicate detection is enabled in the import settings.
It does not run during lead conversions, record merges, status changes like activating or deactivating a record, or API calls, unless SuppressDuplicateDetection is explicitly set to false.
That last one matters most. If you're creating records through Power Automate, an integration, or custom code, duplicate detection is off by default. You have to enable it explicitly in the API call, and even then the native system only blocks or logs based on your rule configuration. It doesn't alert a user, because there's no user in the loop to alert.