> 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/how-to-faq/delpha-duplicate/how-can-i-force-merging-duplicate-records.md).

# How can I force merging duplicate records

Force an immediate merge of duplicate records (Auto Yes / Steward Yes) outside of the automated schedule. Execute the merge batch directly.

## Force Merging Duplicate Records

Duplicate records with a status of **Auto Yes** or **Steward Yes** are automatically merged based on the schedule configured under **Delpha Setup > Duplicates > Merge Settings > Auto Merge Scheduler**.

If you need to trigger an immediate merge outside of the automated schedule, you can manually execute the merge batch using either the **Salesforce Developer Console** or **Custom Apex**.

***

### Option 1: Salesforce Developer Console (Manual Execution)

You can run the merge batch directly using Anonymous Apex in the Developer Console.

1. Open the **Developer Console** in Salesforce (Gear icon > **Developer Console**).
2. Click **Debug** > **Open Execute Anonymous Window** (or press `Ctrl + E` / `Cmd + E`).
3. Paste the following Apex snippet:

```apex
String settingsId = 'YOUR_DELPHA_SETTINGS_RECORD_ID'; // Replace with your Delpha Merge Settings ID
Database.executeBatch(new delpha.DDQ_DuplicateRecordAutoMerge(settingsId), 10);
```

4. Click Execute.

{% hint style="warning" %}
**Batch Size Adjustment**: The `10` parameter defines the batch execution size. If you encounter performance bottlenecks, governor limit errors, or timeout issues, lower this value (down to `1`).
{% endhint %}

### Option 2: Custom Apex Integration (Programmatic Execution)

You can call the `delpha.DDQ_DuplicateRecordAutoMerge` batch class directly within server-side Apex code to automate or customize when force merges occur:

* **Scheduled Apex**: Implement `Schedulable` to run the merge job on a custom schedule distinct from the standard Delpha setup.
* **Queueables or Controllers:** Execute the batch process in response to custom UI button clicks, Apex triggers, or background processes.

#### Example (Scheduled Apex Class):

```apex
public class ScheduledDelphaAutoMerge implements Schedulable {
    public void execute(SchedulableContext sc) {
        String settingsId = 'YOUR_DELPHA_SETTINGS_RECORD_ID'; // Replace with your Delpha Merge Settings ID
        Database.executeBatch(new delpha.DDQ_DuplicateRecordAutoMerge(settingsId), 10);
    }
}
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.delpha.io/delpha-for-salesforce/how-to-faq/delpha-duplicate/how-can-i-force-merging-duplicate-records.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
