CRM 3.0 SDK Contact Merge
I'm using the following code, which is pretty much right out of the sdk documentation example:Dim targetAsNew TargetMergeContactDim mergeReqAsNew MergeRequest
target.EntityId = contactCRM(Pri).contactid.Value
mergeReq.SubordinateId = contactCRM(Sec).contactid.Value
mergeReq.Target = target
Dim mergedAs MergeResponse =CType(crm.Execute(mergeReq), MergeResponse)
I get a "Server was unable to process the request." error on the last line. I am using an account with System Administrator privileges. I have verified that I can write contact information using the SDK, so this problem is merge specific.
Is there a way that merging could be disabled? If so, how do I enable it?
"More detailed" error:
<error> <code>0x80040203</code> <description>Invalid argument.</description> <type>Platform</type> </error>
I have also verified that the guid's are correct and are being properly assigned to both target and mergeReq.
Matt;
You must set the UpdateContent property of the MergeRequest for the code to work.
The latest version of the SDK release has the correct sample code.
// 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);
You can find the sample code online at http://msdn2.microsoft.com/en-us/library/aa682826.aspx.