> For the complete documentation index, see [llms.txt](https://help.delpha.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.delpha.io/delpha-for-salesforce/use-cases-setup/duplicate/duplicate-merge/related-object-rules.md).

# Related Object Rules

### Overview

When merging two records (e.g., Contact A and Contact B), Salesforce automatically re-parents all child records to the surviving Master Record. This can create a new problem: Child Duplicates.

* *Scenario:* Contact A has an Opportunity named "Q3 Deal." Contact B *also* has a duplicate Opportunity named "Q3 Deal."
* *Result without rules:* The final merged Contact will have *two* identical "Q3 Deal" Opportunities in its related list.
* *Solution:* Related Object Rules allow you to detect and merge these child duplicates automatically during the parent merge process.

### How to Configure Related Object Rules

1. Access the Section: In Merge Settings, expand Related Object Rules.
2. Add New Rule: Click the New button.
3. Select the Related Object: Choose the child object you want to manage (e.g., `Opportunity`, `Case`, or a Custom Object).
4. Define the Relationship:
   * Related Object Field: Select the lookup field that connects the child to the parent (e.g., `AccountId` or `ContactId`).
5. Define Deduplication Logic:
   * Duplicate Group Expression: This works like a unique key. Select the field(s) that identify a duplicate *within the context of this parent*.
     * *Example:* For Opportunities, you might select `Name`. If two Opportunities have the exact same `Name` on the same Account, Delpha treats them as duplicates.
     * *Note:* This uses strict exact matching (full match, no fuzzy logic).
6. Select the "Winner" Strategy:
   * Selection Criteria: Decide which of the duplicate child records should be kept.
     * `Keep Based on Newest Record`: Retains the most recently created item.
     * `Keep based On Oldest Record`: Retains the original item.
     * `Keep Based on Latest Modified Record`: Retains the one with the most recent updates.
     * `Keep Master Record Items`: Always prioritizes the child record that was already owned by the Master parent record.

### Example Configuration: Deduplicating Opportunities

To ensure you don't end up with duplicate opportunities after merging Accounts:

* Related Object: `Opportunity`.
* Duplicate Group Expression: `Name` (and optionally `CloseDate`).
* Selection Criteria: `Keep Based on Latest Modified Record`.
* Result: If both Accounts have an opportunity named "Big Deal," only the one updated most recently is kept. The other is deleted/merged.

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://help.delpha.io/delpha-for-salesforce/use-cases-setup/duplicate/duplicate-merge/related-object-rules.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
