MergeRequest MergeRequest MergeRequest MergeRequest Class

Definition

Contains the data that’s needed to merge the information from two entity records of the same type.

For the Web API use the Merge Action.

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

Examples


// Create the target for the request.
              var = new EntityReference();

// Id is the GUID of the account that is being merged into.
      // LogicalName is the type of the entity being merged to, as a string
             target.Id = _account1Id;
             target.LogicalName = Account.EntityLogicalName;

// Create the request.
      var merge = new MergeRequest();
      
      // SubordinateId is the GUID of the account merging.
      merge.SubordinateId = _account2Id;
      merge.Target = target;
      merge.PerformParentingChecks = false;
Console.WriteLine("\nMerging account2 into account1 and adding " + "\"test\" as Address 1 Line 1");

// Create another account to hold new data to merge into the entity.
      // If you use the subordinate account object, its data will be merged.
      var updateContent = new Account();
      updateContent.Address1_Line1 = "test";

// Set the content you want updated on the merged account
      merge.UpdateContent = updateContent;

// Execute the request.
      var merged = (MergeResponse)svc.Execute(merge);

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.

BusinessManagement#Merge1

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 MergeResponse class.

Privileges and Access Rights

To perform this action, the caller must have privileges and access rights on the specified entity in the SubordinateId property and privileges on the entity that is referred to in the Target property.

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

Supported Entities

The following table shows the default entities that support this message. For the listed entities, the caller must be connected to the server for this message to be available.

Entity

For a description of how actions on a parent record affect child records, see Entity relationship behavior.

Merge incidents

The behavior of merge for incidents is different from merging accounts, contacts, or leads in the following ways:

  • The UpdateContent property is not used.

    For other entities this property may be used to transfer selected values from the subordinate record to the target record. When merging incidents the value of this property is ignored.

  • Merge is performed in the security context of the user.

    Merge operations for other entities are performed with a system user security context. Because incident merge operations are performed in the security context of the user, the user must have the security privileges to perform any of the actions, such as re-parenting related records, that are performed by the merge operation.

    If the user merging records doesn’t have privileges for all the actions contained within the merge operation, the merge operation will fail and roll back to the original state.

Constructors

MergeRequest() MergeRequest() MergeRequest() MergeRequest()

Initializes a new instance of the MergeRequest class.

Properties

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)
Parameters Parameters Parameters Parameters

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

(Inherited from OrganizationRequest)
PerformParentingChecks PerformParentingChecks PerformParentingChecks PerformParentingChecks

Gets or sets a value that indicates whether to check if the parent information is different for the two entity records. Required.

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)
SubordinateId SubordinateId SubordinateId SubordinateId

Gets or sets the ID of the entity record from which to merge data. Required.

Target Target Target Target

Gets or sets the target of the merge operation. Required.

UpdateContent UpdateContent UpdateContent UpdateContent

Gets or sets additional entity attributes to be set during the merge operation for accounts, contacts, or leads. This property is not applied when merging incidents. Optional.

Applies to

See also