Wednesday, May 29, 2013

CRM 2011 Error “Object of type 'Microsoft.Xrm.Sdk.Entity' cannot be converted to type...”


This error is coming up when you try to execute a linq query. After checking this out we found out how to resolve this.

What happens is that we create an organization proxy variable and then cast to service context object. Before you cast to service context object you need to enable proxy types in organization service proxy. You can use the code below to do that and that would prevent you from seeing the above error and getting your task done.

orgServiceProxy.EnableProxyTypes();

No comments:

Post a Comment

Retrieving Calendar of a Bookable Resource in Dynamics

There are occasions where we need to retrieve working days and working times of a resource in Dynamics grammatically. This is quite possible...