torsdag 23 augusti 2018

Merge request funnies

I haven't used merge in code for quite some time now, I think the last time I did that was when CRM 2013 was "the shit". Still a funny thing that happens, no biggie and I think most people that does these things get around it fairly quickly. It is however a glitch in the documentation that's worth knowing about.

The issue is in the MergeRequest which takes two inputs as mandatory according to the documentation. It's the "Target", an EntityReference which is a link to the master record, the one that will remain, then its the "SubordinateId" which is just a Guid to the record that should be merged.

So far, so good, now when you just have these two in your request, you get an error, the following error.

There is no UpdateContent, Now this is what the intellisence says about that variable
Not very large, but it says "Optional". It is not.
This variable is an "Entity", the same entity type that the merged records are and in this one you can add whatever fields from that entity that you want to be different from the Target record after the merge and, yes, you can enter whatever you want when you do this programmatically and not only from the secondary record.

Now, this hasn't changed since CRM 2013, it still says optional and you still get an exception if you think that the object is optional.

Small post, hope someone is helped.

Rickard Norström
Developer at CRM-Konsulterna
www.crmkonsulterna.se