---
schema_version: "1"
id: 82dba19f48b74528725d24a7282faa54858459a796cb6b5ef34b3b5ab12d2b50
title: DeleteResult Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_class_DataSource_DeleteResult.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_DataSource_DeleteResult.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: ef7c95e6da9aea68e06c406531d57ed46e76a79724e2c053ec242dc6939a29bd
description: Represents the result of a delete operation on an sObject record. The result is returned by the DataSource.deleteRows method of the DataSource.Connection class.The error message that’s generated by a failed delete operation. Recorded with a result of type DataSource.DeleteResult.The unique identifier of a row that represents an external object record to delete.Indicates whether a delete operation succeeded or failed.Maintains the integrity of lists of type DeleteResult by determining the equality of external objects in a list. This method is dynamic and is based on the equals method in Java.Creates a delete result indicating the failure of a delete request for a given external ID.Maintains the integrity of lists of type DeleteResult by determining the uniqueness of the external object records in a list.Creates a delete result indicating the successful completion of a delete request for a given external ID.
---
# DeleteResult Class

Represents the result of a delete operation on an sObject record. The result is returned by the DataSource.deleteRows method of the DataSource.Connection class.

## Namespace

[DataSource](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_DataSource.htm "The DataSource namespace provides the classes for the Apex Connector Framework. Use the Apex Connector Framework to develop a custom adapter for Salesforce Connect. Then connect your Salesforce organization to any data anywhere via the Salesforce Connect custom adapter.")

## Usage

A delete operation on external object records generates an array of objects of type DataSource.DeleteResult. Its methods create result records that indicate whether the delete operation succeeded or failed.

- **[DeleteResult Properties](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_DataSource_DeleteResult.htm#apex_DataSource_DeleteResult_properties)**
- **[DeleteResult Methods](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_DataSource_DeleteResult.htm#apex_DataSource_DeleteResult_methods)**

## DeleteResult Properties

The following are properties for DeleteResult.

- **[errorMessage](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_DataSource_DeleteResult.htm#apex_DataSource_DeleteResult_errorMessage)**  
    The error message that’s generated by a failed delete operation. Recorded with a result of type DataSource.DeleteResult.
- **[externalId](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_DataSource_DeleteResult.htm#apex_DataSource_DeleteResult_externalId)**  
    The unique identifier of a row that represents an external object record to delete.
- **[success](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_DataSource_DeleteResult.htm#apex_DataSource_DeleteResult_success2)**  
    Indicates whether a delete operation succeeded or failed.

### errorMessage

The error message that’s generated by a failed delete operation. Recorded with a result of type DataSource.DeleteResult.

#### Signature

public String errorMessage {get; set;}

#### Property Value

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.")

### externalId

The unique identifier of a row that represents an external object record to delete.

#### Signature

public String externalId {get; set;}

#### Property Value

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.")

### success

Indicates whether a delete operation succeeded or failed.

#### Signature

public Boolean success {get; set;}

#### Property 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.")

## DeleteResult Methods

The following are methods for DeleteResult.

- **[equals(obj)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_DataSource_DeleteResult.htm#apex_DataSource_DeleteResult_equals)**  
    Maintains the integrity of lists of type DeleteResult by determining the equality of external objects in a list. This method is dynamic and is based on the equals method in Java.
- **[failure(externalId, errorMessage)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_DataSource_DeleteResult.htm#apex_DataSource_DeleteResult_failure)**  
    Creates a delete result indicating the failure of a delete request for a given external ID.
- **[hashCode()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_DataSource_DeleteResult.htm#apex_DataSource_DeleteResult_hashCode)**  
    Maintains the integrity of lists of type DeleteResult by determining the uniqueness of the external object records in a list.
- **[success(externalId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_DataSource_DeleteResult.htm#apex_DataSource_DeleteResult_success)**  
    Creates a delete result indicating the successful completion of a delete request for a given external ID.

### equals(obj)

Maintains the integrity of lists of type DeleteResult by determining the equality of external objects in a list. This method is dynamic and is based on the equals method in Java.

#### Signature

public Boolean equals(Object obj)

#### Parameters

- **obj**:
    
    Type:
    
    Object External object whose key is to be validated.

For information about the equals method, see [Using Custom Types in Map Keys and Sets](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/langCon_apex_collections_maps_keys_userdefined.htm).

#### 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.")

### failure(externalId, errorMessage)

Creates a delete result indicating the failure of a delete request for a given external ID.

#### Signature

public static DataSource.DeleteResult failure(String externalId, String errorMessage)

#### Parameters

- **externalId**:
    
    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.")
    
    The unique identifier of the sObject record to delete.
- **errorMessage**:
    
    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.")
    
    The reason the delete operation failed.

#### Return Value

Type: [DataSource.DeleteResult](#apex_class_DataSource_DeleteResult "Represents the result of a delete operation on an sObject record. The result is returned by the DataSource.deleteRows method of the DataSource.Connection class.")

Status result of the delete operation.

### hashCode()

Maintains the integrity of lists of type DeleteResult by determining the uniqueness of the external object records in a list.

#### Signature

public Integer hashCode()

#### Return Value

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

### success(externalId)

Creates a delete result indicating the successful completion of a delete request for a given external ID.

#### Signature

public static DataSource.DeleteResult success(String externalId)

#### Parameters

- **externalId**:
    
    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.") The external ID of the record to delete.

#### Return Value

Type: [DataSource.DeleteResult](#apex_class_DataSource_DeleteResult "Represents the result of a delete operation on an sObject record. The result is returned by the DataSource.deleteRows method of the DataSource.Connection class.")

Status result of the delete operation for the sObject with the given external ID.