PublishDuplicateRuleRequest Class


Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online

Contains the data that is needed to submit an asynchronous job to publish a duplicate rule.

For the Web API use the PublishDuplicateRule Action.

Namespace:   Microsoft.Crm.Sdk.Messages
Assembly:  Microsoft.Crm.Sdk.Proxy (in Microsoft.Crm.Sdk.Proxy.dll)

Inheritance Hierarchy



[DataContractAttribute(Namespace = "")]
public sealed class PublishDuplicateRuleRequest : OrganizationRequest
<DataContractAttribute(Namespace := "")>
Public NotInheritable Class PublishDuplicateRuleRequest
    Inherits OrganizationRequest


Name Description
System_CAPS_pubmethod PublishDuplicateRuleRequest()

Initializes a new instance of the PublishDuplicateRuleRequest class.


Name Description
System_CAPS_pubproperty DuplicateRuleId

Gets or sets the ID of the duplicate rule to be published. Required.

System_CAPS_pubproperty ExtensionData

Gets or sets the structure that contains extra data. Optional.(Inherited from OrganizationRequest.)

System_CAPS_pubproperty Item[String]

Gets or sets the indexer for the Parameters collection.(Inherited from OrganizationRequest.)

System_CAPS_pubproperty Parameters

Gets or sets the collection of parameters for the request. Required, but is supplied by derived classes.(Inherited from OrganizationRequest.)

System_CAPS_pubproperty RequestId

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

System_CAPS_pubproperty RequestName

Gets or sets the name of the request. Required, but is supplied by derived classes.(Inherited from OrganizationRequest.)


Name Description
System_CAPS_pubmethod Equals(Object)

(Inherited from Object.)

System_CAPS_pubmethod GetHashCode()

(Inherited from Object.)

System_CAPS_pubmethod GetType()

(Inherited from Object.)

System_CAPS_pubmethod ToString()

(Inherited from Object.)


Message Availability

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


Pass an instance of this class to the Execute method, which returns an instance of PublishDuplicateRuleResponse.

Privileges and Access Rights

To perform this action, the caller must have privileges on the DuplicateRule entity and access rights on the record specified in the DuplicateRuleId property.

For a complete list of the required privileges, see PublishDuplicateRule message privileges.

Notes for Callers

A duplicate rule publishing job creates a matchcode for every entity record that a duplicate detection rule applies to. The matchcode is used as a part of the process for detecting duplicates.


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.

// Retrieve all rules for the entity
var rules = _serviceProxy.RetrieveMultiple(
    new QueryByAttribute(DuplicateRule.EntityLogicalName)
    ColumnSet = new ColumnSet("duplicateruleid"),
    Attributes = { "matchingentityname" },
    Values = { entityName }

List<Guid> crmAsyncOperationIds = new List<Guid>();
foreach (var item in rules.Entities)
    Console.WriteLine(String.Concat("Publishing duplicate rule: ", item.Id));

    // Publish each rule and get the job id since it is async
    var response = (PublishDuplicateRuleResponse)_serviceProxy.Execute(
            new PublishDuplicateRuleRequest { DuplicateRuleId = item.Id });


Thread Safety

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Microsoft.Crm.Sdk.Messages Namespace
PublishDuplicateRule message privileges
Sample: Enable duplicate detection and retrieve duplicates
Detect duplicate data
How role-based security can be used to control access to entities in Microsoft Dynamics 365
How record-based security can be used to control access to records in Microsoft Dynamics 365

Return to top

Microsoft Dynamics 365

© 2016 Microsoft. All rights reserved. Copyright