Monday, December 15, 2014

Incident.ResponsibleContactId is obsolete, replaced by PrimaryContactId

Found another interesting new wrinkle in CRM 2013/2015.  Apparently there has been a schema change on the Incident / Case entity, or at least a schema replacement.

I was rebuilding a Plugin that was originally developed with CRM 2011.  In the Plugin, there was an early bound reference to the system entity for Incident, where I was looking at the ResponsibleContactId.

Symptom:
When building the plugin Assembly, you get this error:


Warning 4 'xxxx.Incident.ResponsibleContactId' is obsolete  .....

Output Windows will show something like this:

.... warning CS0612: 'xxxx.Incident.ResponsibleContactId' is obsolete

If you browse the .cs file generated by CrmSvcUtil, you will see this in the line with the System.ObsoleteAttribute() added.

/// <summary> /// Choose an additional customer contact who can also help resolve the case. /// </summary> [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("responsiblecontactid")] [System.ObsoleteAttribute()] public Microsoft.Xrm.Sdk.EntityReference ResponsibleContactId { .... }

So I had never seen System.ObsoleteAttribute() before, so naturally I Googled... uh, I mean, Bing'ed... the term to see what was up.

DotNetPerls had a pretty good explanation.

Still couldn't figure why Microsoft would obsolete this attribute, until I ended up on this page:


The key here is the Note at the beginning about the ResponsibleContactId being replaced by PrimaryContactId

The incident entity ResponsibleContactId lookup attribute should be considered deprecated and the PrimaryContactId lookup attribute introduced with the Microsoft Dynamics CRM 2013 Service Pack 1 (SP1) release should be considered the primary system lookup attribute to associate incidents with a contact record.
There are no plans to remove the ResponsibleContactId lookup attribute, but if you plan to create new customizations you should use PrimaryContactId rather thanResponsibleContactId. If you have existing customizations that currently use ResponsibleContactId, you should consider migrating them to use PrimaryContactId instead.

So, ResponsibleContactId will be around for a while, but is being replaced.

A lot of my PluginCode for the 2 CRM instances I manage uses this field, so I'm going to have to rework how those work, or just ignore the message for a while.  

No comments:

Post a Comment