Freigeben über

DeleteRequest Class


Contains the data that is needed to delete a record.

public ref class DeleteRequest sealed : Microsoft::Xrm::Sdk::OrganizationRequest
public sealed class DeleteRequest : Microsoft.Xrm.Sdk.OrganizationRequest
type DeleteRequest = class
    inherit OrganizationRequest
Public NotInheritable Class DeleteRequest
Inherits OrganizationRequest


The following example shows how to use this message. For this sample to work correctly, you must be connected to the server to get an IOrganizationService interface instance.

The following example demonstrates using optional parameters.

/// <summary>
/// Demonstrates deleting a record with optional parameters
/// </summary>
/// <param name="service">Authenticated IOrganizationService instance</param>
static void DeleteWithOptionalParameters(IOrganizationService service)
    Guid accountId = new("8eb3e71c-9a51-ee11-be6f-000d3a993550");

    // Simulate an account record retrieved
    Entity retrievedAccount = new("account", accountId);

    DeleteRequest request = new()
        Target = retrievedAccount.ToEntityReference()

    // Set a shared variable that a plug-in can access
    request["tag"] = "RecordDeletedBySampleCode";
    // Bypass plug-in logic if caller has prvBypassCustomPlugins privilege
    request["BypassCustomPluginExecution"] = true;
    // Don't trigger any flows for this operation
    request["SuppressCallbackRegistrationExpanderJob"] = true;


For an example showing optimistic concurrency checks see the ConcurrencyBehavior property.

Sample code on GitHub

Use optimistic concurrency with update and delete operations



Pass an instance of this class to the Execute(OrganizationRequest) method, which returns an instance of the DeleteResponse class.

Privileges and Access Rights

To perform this action, the caller must have delete privileges on the table and access rights on the record specified by the Target property. Learn more about how to verify access in code

Notes for Callers

Use this class when you want to:

For a less complex method that deletes a single record, without the ability to manage concurrency or use optional parameters, use the IOrganizationService.Delete method.

When a record is deleted, some related records may also be deleted depending on the cascade configuration for relationships. If the relationship specifies Cascade All for the Delete action, the operation will attempt to delete related records. The entire operation fails if the caller does not have the delete privilege or access rights for any of these records. Learn more about table relationship behavior

Typically, you should only delete records that you entered by mistake. For some record types, you can deactivate or close the record instead.

Supported Tables

See Message support for tables for an example query you can use to get the list of tables you can use with the Delete message.



Initializes a new instance of the DeleteRequest class.



Specifies the type of optimistic concurrency behavior that should be performed by Dataverse when processing this request.


Gets or sets the structure that contains extra data. Optional.

(Inherited from OrganizationRequest)

Gets or sets the indexer for the Parameters collection.

(Inherited from OrganizationRequest)

Gets or sets the collection of parameters for the request. Required, but is supplied by derived classes.

(Inherited from OrganizationRequest)

Gets or sets the ID of the request. Optional.

(Inherited from OrganizationRequest)

Gets or sets the name of the request. Required, but is supplied by derived classes.

(Inherited from OrganizationRequest)

Gets or sets the reference to the record that you want to delete. Required.

Applies to

See also