Friday, June 10, 2011

CRM 2011 RetrieveMultiple (QueryExpression) no longer returning the primary key

As we migrate our project from CRM 4 to CRM 2011 it was apparent that some of our "supported" code wasn't even working.  One such case was using the QueryExpression/RetrieveMultiple, (we're still using the 2007 end points).  The problem was we've always assumed the primary key ALWAYS comes back with a RetrieveMultipleRequest.

As it turns out, in Dynamics CRM 2011 even the 2007 end points behave a little differently.  When setting Distinct to true in the query expression, the primary key won't automatically be returned (if its not in the ColumnSet).

Obviously, this points at a misuse of the distinct keyword.  If I really needed distinct, I wouldn't need the primary key.  If I really needed the primary key, I wouldn't be getting distinct records.  Hope this saves someone else some time.

Another breaking change in the 2007 end points is the RetrieveUserPrivileges request no longer functions.  I don't have a work-around for this other than to upgrade to the 2011 end points.  And I haven't found a way to contact the 2011 end points in the ISV folder like we could in CRM 4.  Unfortunate.  Luckily I'm able to move a lot of the privilege checks to the ribbon.

What breaking CrmService messages have you found when using the 2007 end points in CRM 2011?

No comments: