BulkDetectDuplicatesRequest BulkDetectDuplicatesRequest BulkDetectDuplicatesRequest BulkDetectDuplicatesRequest Class

Definition

Contains the data that is needed to submit an asynchronous system job that detects and logs multiple duplicate records.

For the Web API use the BulkDetectDuplicates Action.

Web API support for this message was added with December 2016 update for Microsoft Dynamics 365 (online) and December 2016 Service Pack for Microsoft Dynamics 365 (on-premises)

public ref class BulkDetectDuplicatesRequest sealed : Microsoft::Xrm::Sdk::OrganizationRequest
[System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/crm/2011/Contracts")]
public sealed class BulkDetectDuplicatesRequest : Microsoft.Xrm.Sdk.OrganizationRequest
type BulkDetectDuplicatesRequest = class
    inherit OrganizationRequest
Public NotInheritable Class BulkDetectDuplicatesRequest
Inherits OrganizationRequest
Inheritance
BulkDetectDuplicatesRequestBulkDetectDuplicatesRequestBulkDetectDuplicatesRequestBulkDetectDuplicatesRequest
Attributes

Examples


// Connect to the Organization service. 
// The using statement assures that the service proxy will be properly disposed.
using (var svc = new CrmServiceClient(connectionstring))
{
    CreateRequiredRecords();

// Create the BulkDetectDuplicatesRequest object
    Console.WriteLine("  Creating the BulkDetectDuplicatesRequest object");
    var request = new BulkDetectDuplicatesRequest()
    {
        JobName = "Detect Duplicate Accounts",
        Query = new QueryExpression()
        {
            EntityName = Account.EntityLogicalName,
            ColumnSet = new ColumnSet(true)
        },
        RecurrencePattern = String.Empty,
        RecurrenceStartTime = DateTime.Now,
        ToRecipients = new Guid[0],
        CCRecipients = new Guid[0]
    };

// Execute the request
    Console.WriteLine("  Executing BulkDetectDuplicatesRequest");
    _response = (BulkDetectDuplicatesResponse)svc.Execute(request);

#region check success
    Console.WriteLine("  Waiting for job to complete...");
    WaitForAsyncJobToFinish(_response.JobId, 120);

var query = new QueryByAttribute()
    {
        ColumnSet = new ColumnSet(true),
        EntityName = "duplicaterecord"
    };
    query.Attributes.Add("asyncoperationid");
    query.Values.Add(_response.JobId);
    EntityCollection results = svc.RetrieveMultiple(query);

// check to make sure each id is found in the collection
    var duplicateIds = results.Entities.Select((entity) => 
        ((DuplicateRecord)entity).BaseRecordId.Id);
    foreach (var id in _duplicateAccounts.Select((account) => account.Id))
    {
        if (!duplicateIds.Contains(id))
        {
            throw new Exception(String.Format(
                "Account with ID {0} was not detected as a duplicate",
                id));
        }
    }
    Console.WriteLine("  All accounts detected as duplicates successfully");

#endregion
    
    Console.WriteLine();
    DeleteRequiredRecords(promptforDelete);
}

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. For the complete sample, see the link later in this topic.

DuplicateDetection#BulkDetectDuplicates1 DuplicateDetectionVB#BulkDetectDuplicates1

Remarks

Message Availability

For this message to work, the caller must be connected to the server.

Usage

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

Privileges and Access Rights

To perform this action, the caller must have access rights on the entity records that are specified in the request class. For a complete list of the required privileges, see BulkDetectDuplicates message privileges.

Notes for Callers

The asynchronous system job detects multiple duplicate records and logs them as duplicate records by using the DuplicateRecord entity. Before you use this message, set the IsDuplicateDetectionEnabled attribute for an entity to true and publish all duplicate rules (duplicate detection rules) for an entity.

Constructors

BulkDetectDuplicatesRequest() BulkDetectDuplicatesRequest() BulkDetectDuplicatesRequest() BulkDetectDuplicatesRequest()

Initializes a new instance of the BulkDetectDuplicatesRequest class.

Properties

CCRecipients CCRecipients CCRecipients CCRecipients

Gets or sets an array of IDs for the system users (users) who are listed in the Cc box of the email notification.

ExtensionData ExtensionData ExtensionData ExtensionData

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

(Inherited from OrganizationRequest)
Item[String] Item[String] Item[String] Item[String]

Gets or sets the indexer for the Parameters collection.

(Inherited from OrganizationRequest)
JobName JobName JobName JobName

Gets or sets the name of the asynchronous system job that detects and logs multiple duplicate records. Required.

Parameters Parameters Parameters Parameters

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

(Inherited from OrganizationRequest)
Query Query Query Query

Gets or sets the query criteria for detecting multiple duplicate records. Required.

RecurrencePattern RecurrencePattern RecurrencePattern RecurrencePattern

Gets or sets the recurrence pattern for the asynchronous system job that detects multiple duplicate records. Optional.

RecurrenceStartTime RecurrenceStartTime RecurrenceStartTime RecurrenceStartTime

Gets or sets the start date and time of an asynchronous system job that detects and logs multiple duplicate records. Optional.

RequestId RequestId RequestId RequestId

Gets or sets the ID of an asynchronous operation (system job). Optional.

(Inherited from OrganizationRequest)
RequestName RequestName RequestName RequestName

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

(Inherited from OrganizationRequest)
SendEmailNotification SendEmailNotification SendEmailNotification SendEmailNotification

Gets or sets a value that indicates whether an email notification is sent after the asynchronous system job that detects multiple duplicate records finishes running. Required.

TemplateId TemplateId TemplateId TemplateId

Sets the ID of the template (email template) that is used for the email notification.

ToRecipients ToRecipients ToRecipients ToRecipients

Gets or sets an array of IDs for the system users (users) who are listed in the “To” box (recipients) of the email notification.

Applies to

See also