共用方式為


CompoundUpdateDuplicateDetectionRuleRequest Class

Definition

Contains the data that is needed to update a duplicate rule (duplicate detection rule) and its related duplicate rule conditions.

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

Examples

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 static CompoundUpdateDuplicateDetectionRuleExample method shows how to update an existing duplicate detection rule.

/// <summary>
/// Demonstrates updating an existing duplication rule
/// </summary>
/// <param name="service">The authenticated IOrganizationService instance</param>
/// <param name="duplicateRuleId">The ID of the duplicaterule to update.</param>
static void CompoundUpdateDuplicateDetectionRuleExample(IOrganizationService service, Guid duplicateRuleId)
{
      // Data for a duplicate detection rule for the account table
      Entity accountRule = new("duplicaterule", duplicateRuleId)
      {
         Attributes =
         {
            {"name","Accounts with the same name and email address" },
            {"description","A rule to detect duplicate accounts by name and email address."},
            {"baseentityname","account"},
            {"matchingentityname","account" },
            {"iscasesensitive",false },
            {"statecode", new OptionSetValue(1) }, // Active
            {"statuscode", new OptionSetValue(2) } // Published
         }
      };

      // A duplicate rule condition for the account name attribute
      Entity accountNameCondition = new("duplicaterulecondition")
      {
         Attributes = {
            {"baseattributename", "name" },
            {"matchingattributename", "name" },
            {"operatorcode", new OptionSetValue(0) } //Exact match
         }
      };


      // A duplicate rule condition for the account email attribute
      Entity accountEmailCondition = new("duplicaterulecondition")
      {
         Attributes = {
            {"baseattributename", "emailaddress1" },
            {"matchingattributename", "emailaddress1" },
            {"operatorcode", new OptionSetValue(0) } //Exact match
         }
      };

      EntityCollection childEntities = new(new List<Entity>
      {
         accountNameCondition,
         accountEmailCondition
      })
      {
         EntityName = "duplicaterulecondition"
      };

      // Create a compound update request to update the rule and its conditions
      CompoundUpdateDuplicateDetectionRuleRequest request = new()
      {
         Entity = accountRule,
         ChildEntities = childEntities
      };
      // Execute the request
      service.Execute(request);

}

Remarks

For the Web API use the CompoundUpdateDuplicateDetectionRule action.

Usage

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

Privileges and Access Rights

To perform this action, the caller must have privileges on the DuplicateRule entity and the DuplicateRuleCondition entity.

These privileges are required: prvAppendToDuplicateRule, prvCreateDuplicateRule, prvReadDuplicateRule, and prvWriteDuplicateRule.

Constructors

CompoundUpdateDuplicateDetectionRuleRequest()

Initializes a new instance of the CompoundUpdateDuplicateDetectionRuleRequest class.

Properties

ChildEntities

Gets or sets a collection of the duplicate rule conditions that you want updated. Required.

Entity

Gets or sets the duplicate rule that you want updated. Required.

ExtensionData

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

(Inherited from OrganizationRequest)
Item[String]

Gets or sets the indexer for the Parameters collection.

(Inherited from OrganizationRequest)
Parameters

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

(Inherited from OrganizationRequest)
RequestId

Gets or sets the ID of the request. Optional.

(Inherited from OrganizationRequest)
RequestName

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

(Inherited from OrganizationRequest)

Applies to

See also