---
schema_version: "1"
id: 1a38723af68bc2fb2c5b195ed3adb0c307a972c56305fa9b99d8ffc70361213e
title: MergeResult Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_class_database_mergeresult.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_database_mergeresult.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 01e138c965ee5df2af2fb671f12263ac3c406cd55ad723ea48c8f94eadd18271
description: Contains the result of a merge Database method operation.Returns a list of Database.Error objects representing the errors encountered, if any, during a merge operation using the Database.merge method. If no error occurred, returns null.Returns the ID of the master record into which other records were merged.Returns the IDs of the records merged into the master record.Returns the IDs of all related records that were reparented as a result of the merge that are viewable by the user sending the merge call.Indicates whether the merge was successful (true) or not (false).
---
# MergeResult Class

Contains the result of a merge Database method operation.

## Namespace

[Database](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_Database.htm "The Database namespace provides classes used with DML operations.")

## Usage

The Database.merge method returns a Database.MergeResult object for each merged record.

## MergeResult Methods

The following are methods for MergeResult. All are instance methods.

- **[getErrors()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_database_mergeresult.htm#apex_Database_MergeResult_getErrors)**  
    Returns a list of Database.Error objects representing the errors encountered, if any, during a merge operation using the Database.merge method. If no error occurred, returns null.
- **[getId()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_database_mergeresult.htm#apex_Database_MergeResult_getId)**  
    Returns the ID of the master record into which other records were merged.
- **[getMergedRecordIds()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_database_mergeresult.htm#apex_Database_MergeResult_getMergedRecordIds)**  
    Returns the IDs of the records merged into the master record.
- **[getUpdatedRelatedIds()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_database_mergeresult.htm#apex_Database_MergeResult_getUpdatedRelatedIds)**  
    Returns the IDs of all related records that were reparented as a result of the merge that are viewable by the user sending the merge call.
- **[isSuccess()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_database_mergeresult.htm#apex_Database_MergeResult_isSuccess)**  
    Indicates whether the merge was successful (true) or not (false).

### getErrors()

Returns a list of Database.Error objects representing the errors encountered, if any, during a merge operation using the Database.merge method. If no error occurred, returns null.

#### Signature

public List<Database.Error> getErrors()

#### Return Value

Type: [List](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_list.htm#apex_methods_system_list "Contains methods for the List collection type.")<[Database.Error](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_database_error.htm#apex_methods_system_database_error "Represents information about an error that occurred during a DML operation when using a Database method.")\>

### getId()

Returns the ID of the master record into which other records were merged.

#### Signature

public Id getId()

#### Return Value

Type: [ID](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_id.htm#apex_methods_system_id "Contains methods for the ID primitive data type.")

### getMergedRecordIds()

Returns the IDs of the records merged into the master record.

#### Signature

public List<String\> getMergedRecordIds()

#### Return Value

Type: [List](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_list.htm#apex_methods_system_list "Contains methods for the List collection type.")<[String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")\>

### getUpdatedRelatedIds()

Returns the IDs of all related records that were reparented as a result of the merge that are viewable by the user sending the merge call.

#### Signature

public List<String\> getUpdatedRelatedIds()

#### Return Value

Type: [List](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_list.htm#apex_methods_system_list "Contains methods for the List collection type.")<[String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")\>

### isSuccess()

Indicates whether the merge was successful (true) or not (false).

#### Signature

public Boolean isSuccess()

#### Return Value

Type: [Boolean](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_boolean.htm#apex_methods_system_boolean "Contains methods for the Boolean primitive data type.")