If you are working on code to merge two entity records and come across “Cannot specify child attribute retrieve” error; and you have referred SDK/MSDN documentation. You probably have kept UpdateContent property optional and havent set it. UpdateContent is a required property though the documentation says it is not.
This property is optional in case of merging incidents only.
You just have to set Entity object to UpdateContent property which has attributes to be updated to the merged record.
Entity contact = new Entity("contact");
contact["firstname"] = "Crm";
contact["lastname"] = "Xpress";
// merging contact records
MergeRequest merge = new MergeRequest
// SubordinateId is the GUID of the contact merging.
SubordinateId = contactId,
Target = target,
PerformParentingChecks = true,
UpdateContent = contact // Entity Object to set the content you want updated on the merged contact
Many a times unexpected things happen while programming. And in case of Dynamics CRM it “does” happen. Similar issue happened with me today. The subject of the blog post was the annoying error I wanted to get rid off.
The given key was not found in the dictionary.
The first thing comes into the programmers’ mind is that there is nothing in this error and they just need to cross check with the attribute logical names they have used in coding.
To solve this I cross checked each and every attributes from Dynamics CRM and my C# code and not for single but 3-4 times. Finally, I got the idea that all my code is working absolutely correct with nothing wrong in it.
The real issue was not my code but a plugin/workflow activity developed by some other programmer which was registered on the same entity which I was working on. I disabled the step of the workflow activity and the program worked like a charm.
Check for the Plugins or Workflow Activities registered on the same entity to drill down with your issue.