Share via


Run bulk delete

 

Applies To: Dynamics CRM 2013

To delete data in bulk, you have to submit a bulk delete job by using the BulkDeleteRequest message. The bulk delete job runs asynchronously in the background without blocking other activities. The query expressions that describe the records on which to run the bulk delete job are specified in the QuerySet property of this request.

A bulk delete job is represented by the bulk delete operation entity. The schema name for this entity is BulkDeleteOperation. A bulk delete operation record includes the following information:

  • Number of records that the bulk delete job deleted.

  • Number of records that the bulk delete job failed to delete.

  • Whether the bulk delete job is a recurring job or not.

  • Start time of the bulk delete job.

A bulk delete job only deletes records that are created before the job starts to run.

Note

If a bulk delete job fails or ends prematurely, any records that were deleted before the failure or ending of the job are not rolled back and remain deleted. The failures of the BulkDeleteOperation are stored in the BulkDeleteFailure records and can be retrieved by using the RetrieveRequest message or the RetrieveMultiple message.

A bulk delete job deletes the specified records according to the cascading rules. These rules are based on the relationship type between the entities. For more information, see Entity relationship behavior.

To run a bulk delete job, a user must have the BulkDelete message privileges and Delete message privileges for the entity types being deleted. The user must also have read permissions to the entity records that are specified in the BulkDeleteRequest message. By default, a system administrator has the necessary permissions; however, other users must be granted these permissions.

You can perform a bulk deletion on all entities that are supported by the delete action. For information about possible actions on entity records, see Actions on entity records.

If a plug-in or a workflow (process) is triggered by the delete action on a specific entity type, it is triggered every time that an entity record of this type is deleted by the bulk delete job.

See Also

Delete data in bulk
Manage your data
Security role and privilege reference
Entity relationship behavior
Recurrence pattern in asynchronous job execution
Sample: Bulk delete exported records
Sample: Bulk delete records that match common criteria
BulkDeleteOperation entity messages and methods