# Filtering Rules

### Overview

While Matching Fields rely on a weighted score to *guess* if records are duplicates, Filtering Rules allow you to enforce strict decisions or add context. You use these rules to immediately confirm a match (Exact Match), disqualify a bad match (Discard), or annotate a pair with specific instructions (Keep).

### Rule Types

There are three distinct actions you can enforce:

1. **Exact Match** (The Same Record):
   * Action: Forces the duplicate score to 100 immediately.
   * Use Case: When unique identifiers match (e.g., Legal ID or Email), you don't need fuzzy logic; you know it is the same record.
2. **Discard** (Non Duplicates or require data steward analysis before decision):
   * Action: Immediately removes the pair from the Potential or Exact Match results duplicate results.
   * Use Case: Preventing false positives (e.g., "If `Family Name` is matching but `City` is different, discard the match").
3. **Keep** (Duplicates):
   * Action: Does not alter the score. Instead, it simply adds a comment to the potential pair.
   * Use Case: Providing context to the user who reviews the duplicate (e.g., flagging records that share the same "Parent Account" so the user understands *why* they are seeing this match).

{% hint style="info" %}
Rules apply from Top to down. Once a rule is matched, the following rules are discarded.
{% endhint %}

### How to Configure a Filtering Rule

1. Access the Section: In Detection Settings, expand the Filtering Rules section.
2. Add New Rule: Click the + Add Rule button.
3. Define Conditions ("If"):
   * Select a field (e.g., `Name`, `Legal ID`).
   * Select the logic (e.g., `is the same`, `is not the same`, `is equal to`... ).
   * *Optional:* Click + Add Condition to create multi-step logic.
4. Define Consequence ("Then"):
   * Choose the outcome: Exact Match, Duplicates (Keep), or Non Duplicates (Discard).
5. Add Context :
   * Comment: Enter a text string (e.g., `"Same Parent Company"`) that will appear on the duplicate card to explain the situation to the user.

{% hint style="warning" %}
Ensure the fields in your filtering rules are defined in the [Matching Fields section](/delpha-for-salesforce/use-cases-setup/duplicate/duplicate-detection/matching-fields.md) to avoid errors.
{% endhint %}

### Strategic Examples

#### 1. The "Golden Key" Rule (Exact Match)

If a unique government ID matches, the records are identical regardless of typos in the name.

* Condition: If `Legal ID` is the same.
* Action: `The Same Record (Exact Match)`.
* Result: Score set to 100.

#### 2. The "False Positive" Blocker (Discard)

Common names often trigger bad matches. Use geography to filter them.

* Condition: If `City` is different.
* Action: `Non Duplicates (Discard)`.
* Result: Even if "John Smith" matches "John Smith," if one is in London and the other in Paris, the duplicate is ignored.

#### 3. The "Contextual Note" (Keep)

You want to warn the user that two contacts work for the same company, even if they aren't strict duplicates yet.

* Condition: If `Parent Account` is the same.
* Action: `Duplicates (Keep)`.
* Comment: `"Same Parent Account"`.
* Result: The user sees this comment on the duplicate card, helping them decide whether to merge or separate the contacts.

{% hint style="info" %}

* Filters affect the [duplicate status,](/delpha-for-salesforce/how-to-faq/delpha-duplicate/what-are-the-duplicate-status.md) which reflects the lifecycle of duplicate pairs.
* [Reporting](/delpha-for-salesforce/how-to-faq/delpha-duplicate/how-can-i-create-custom-reports-on-duplicate.md) on these statuses can help you understand your current situation and determine the necessary actions.
  {% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.delpha.io/delpha-for-salesforce/use-cases-setup/duplicate/duplicate-detection/filtering-rules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
