Export (0) Print
Expand All
Expand Minimize

Merge Message (CrmService)

banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Find the latest SDK documentation: CRM 2015 SDK

Works for all deployment typesWorks online only

Merges the information from two entity instances of the same type.

The relevant classes are specified in the following table.

TypeClass
RequestMergeRequest
ResponseMergeResponse
TargetTargetMerge
EntitySee below.

The following table shows the entities and target classes for this message.

EntityTarget Class
accountTargetMergeAccount
contactTargetMergeContact
leadTargetMergeLead
DynamicEntityTargetMergeDynamic

Remarks

To use this message, pass an instance of the MergeRequest class as the request parameter in the Execute method.

For a description of how actions on a parent instance affect child instances, see Cascading Rules.

For a list of required privileges, see Merge Privileges.

Example

The following code example shows how to use the Merge message.

[C#]
// Set up the CRM service.
CrmAuthenticationToken token = new CrmAuthenticationToken();
// You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0; 
token.OrganizationName = "AdventureWorksCycle";
 
CrmService service = new CrmService();
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;

// Create the target for the request.
TargetMergeAccount target = new TargetMergeAccount();
// EntityId is the GUID of the account that is being merged into.
target.EntityId = new Guid("2B951FBC-1C56-4430-B23B-20A1349068F3");

// Create the request.
MergeRequest merge = new MergeRequest();
// SubordinateId is the GUID of the account merging.
merge.SubordinateId = new Guid("AD618DB2-F0DB-4A6A-8C4B-2F2213EAA38E");
merge.Target = target;
merge.PerformParentingChecks = false;

account updateContent = new account();
updateContent.address1_line1 = "test";
merge.UpdateContent = updateContent;
      

// Execute the request.
MergeResponse merged = (MergeResponse)service.Execute(merge);
[Visual Basic .NET]
' Set up the CRM service.
Dim token As New CrmAuthenticationToken()
' You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0
token.OrganizationName = "AdventureWorksCycle";
 
Dim service As New CrmService()
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials

' Create the target for the request.
Dim target As New TargetMergeAccount()
' EntityId is the GUID of the account that is being merged into.
target.EntityId = New Guid("2B951FBC-1C56-4430-B23B-20A1349068F3");

' Create the request.
Dim merge As New MergeRequest()
' SubordinateId is the GUID of the account merging.
merge.SubordinateId = New Guid("AD618DB2-F0DB-4A6A-8C4B-2F2213EAA38E");
merge.Target = target
merge.PerformParentingChecks = False

Dim updateContent As New account()
updateContent.address1_line1 = "test"
merge.UpdateContent = updateContent

' Execute the request.
Dim merged As MergeResponse = CType(service.Execute(merge), MergeResponse)

See Also

Reference


© 2010 Microsoft Corporation. All rights reserved.


Show:
© 2015 Microsoft