# What is a Filtering Rule and how to use it

## How to Define Exclusion Rules for Duplicate Pairs in Delpha

After Delpha identifies potential duplicate pairs, you may want to **refine, exclude, or annotate** some of them using **exclusion rules**. These rules help automatically filter out certain matches based on field-level comparisons and predefined logic.

## What Are Exclusion Rules?

Exclusion rules let you define **custom logic to update the status of a duplicate pair** and optionally add a comment explaining why the pair should not be considered a valid match.

* ✅ If a rule is triggered → The pair's status is changed to **Auto No**, and a comment is added.
* ❌ If not triggered → No change in status, but a comment may still be added depending on your settings.

## How to Define an Exclusion Rule

{% hint style="success" %}
From version 3.56, we've replaced the old JSON-based interface with a [new visual rule builder to simplify and streamline duplicate rule configuration.](/delpha-for-salesforce/delpha-upgrade/whats-new/duplicate/build-3.56.md#visual-rule-builder-for-duplicate-management)
{% endhint %}

1. **Select the Field to Compare**\
   Choose a field from the object (Account, Contact, etc.).&#x20;

{% hint style="danger" %}
The field must be defined in the **Fields** section of the duplicate detection settings.
{% endhint %}

2. **Choose an Operator**\
   Operators (case-sensitive, lowercase) define how the field is evaluated:

* `same`: Both field values are equal
* `not same`: Field values are different
* `empty`: Field is empty for both records
* `not empty`: Field is filled in both records
* `equal`: Field value equals a specific value
* `not equal`: Field value does not equal a specific value
* `greater than`, `lower than`: Compare numerical or date values

3. **Enter Comparison Value** (if needed)\
   Only required for: `equal`, `not equal`, `greater than`, `lower than`\
   No input needed for: `same`, `not same`, `empty`, `not empty`
4. **Define the Action (Discard Field)**
   * `discard = true`: Pair is marked as **Auto No**, and the comment is added
   * `discard = false`: Only the comment is added; status remains unchanged
5. **Add a Comment (Optional)**\
   Define a custom message to populate the **Comment** field when the rule is applied. This helps document the logic behind each exclusion.

## Rule Logic & Conditions

* **Within a rule**: Conditions use **AND** logic
* **Across multiple rules**: Evaluation uses **OR** logic
* **Evaluation order**: Rules are applied from **top to bottom**

## Practical Examples (Accounts)Oner&#x20;

<table><thead><tr><th width="55">Rule</th><th width="394">Condition(s)</th><th>Action</th><th>Comment</th></tr></thead><tbody><tr><td>1</td><td>Condition: <strong>One RecordType is 'Group'</strong><br>Not Same <code>RecordType</code> + Equal <code>RecordType = Group</code></td><td>Discard</td><td>"group"</td></tr><tr><td>2</td><td>Condition: <strong>One RecordType is a Partnership, the other is an Entity</strong><br>Not Same <code>RecordType</code> + Equal <code>RecordType = Partnership</code> + Equal <code>RecordType = Entity</code></td><td>Discard</td><td>"Partnership vs Entity"</td></tr><tr><td>3</td><td><p>Condition: <strong>The RecordType are different</strong> </p><p>Not Same <code>RecordType</code></p></td><td>Discard</td><td>"record type"</td></tr><tr><td>4</td><td><p>Condition: <strong>The records have different City fields</strong></p><p>Not Same <code>City</code></p></td><td>Discard</td><td><em>(Add comment)</em></td></tr><tr><td>5</td><td><p>Condition: <strong>The records have different Country fields</strong></p><p>Not Same <code>Country</code></p></td><td>Discard</td><td><em>(Add comment)</em></td></tr><tr><td>6</td><td><p>Condition: <strong>The records have different NetSuiteId fields</strong></p><p>Not Same <code>NetSuiteId</code> (custom)</p></td><td>Discard</td><td><em>(Add comment)</em></td></tr><tr><td>7</td><td><p>Condition: <strong>The records have different AccountSegment fields</strong></p><p>Not Same <code>Account Segment</code> (custom)</p></td><td>Discard</td><td><em>(Add comment)</em></td></tr><tr><td>8</td><td><p>Condition: <strong>The records have different AccountType fields</strong></p><p>Not Same <code>Account Type</code> (custom)</p></td><td>Discard</td><td><em>(Add comment)</em></td></tr></tbody></table>

***

{% hint style="warning" %}
[You can combine rules to detect cases where one value is fixed. ](/delpha-for-salesforce/how-to-faq/delpha-duplicate/filtering-rule-one-value-is-set.md)
{% endhint %}

### Examples in JSON

<pre class="language-json5"><code class="lang-json5">[  
# RULE 1
   {
    "name" :  "Rule 1",
    "comment" : "One record type is a Group",
<strong>    "discard" : true,
</strong>    "rules" : 
    [
     {
      "field":"RecordType",
      "operator":"not same"
     },
# AND
<strong>     {
</strong>      "field":"RecordType",
      "operator":"equal",
      "value”:"Group"
     }
    ]
   },                    
# OR
# RULE 2
   {
    "name": "Rule 2",
    "comment":"Partnership vs Entity",
    "discard":true,
    "rules" : 
    [
     {
      "field":"RecordType",
      "operator":"not same"
     },
# AND
     {
      "field":"RecordType",
      "operator":"equal",
      "value" : "Partnership"
     },
# AND 
     {
      "field":"RecordType",
      "operator":"equal",
<strong>      "value" : "Entity"
</strong>     } 
    ]
   },
# OR
# RULE 3
   {
    "name" :  "Rule 3",
    "comment" : "Different RecordType",
    "discard" : true,
    "rules" : 
    [
     {
      "field":"RecordType",
      "operator":"not same"
     }
    ]
  },

# OR
# RULE 4
   {
    "name" :  "Rule 4",
    "comment" : "Different City",
    "discard" : true,
    "rules" : 
    [
     {
      "field":"BillingCity",
      "operator":"not same"
     }
    ]
   },
# OR
# RULE 5
   {
    "name" :  "Rule 5",
    "comment" : "Different Country",
    "discard" : true,
    "rules" : 
    [
     {
      "field":"BillingCountry",
      "operator":"not same"
     }
    ]
   },
# OR
# RULE 6
   {
    "name" :  "Rule 6",
    "comment" : "Different NetSuite Id",
    "discard" : true,
    "rules" : 
    [
     {
      "field":"NetSuiteId__c",
      "operator":"not same"
     }
    ]
   },
# OR
# RULE 7
   {
    "name" :  "Rule 7",
    "comment" : "Different Segment",
    "discard" : true,
    "rules" : 
    [
     {
      "field":"AccountSegment__c",
      "operator":"not same"
     }
    ]
   },
# OR
# RULE 8
   {
    "name" :  "Rule 8",
    "comment" : "Different AccountType",
    "discard" : true,
    "rules" : 
    [
     {
      "field":"AccountType__c",
      "operator":"not same"
     }
    ]
   },
# OR
# RULE 9
   {
    "name" :  "Rule 9",
    "comment" : "French Duplicate",
    "discard" : false,
    "rules" : 
    [
     {
      "field":"BillingCountry",
      "operator":"same"
     },
#AND
     {
      "field":"BillingCountry",
      "operator":"equal",
      "value”:"France"
     }
    ]
   }
]
</code></pre>

{% hint style="info" %}

* \#AND and #OR are here for readability purpose only. They should be removed before applying the JSON.
* API names must be used in JSON for the field tag.
  {% 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/how-to-faq/delpha-duplicate/what-is-a-filtering-rule-and-how-to-use-it.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.
