I have a CRM function that returns the attribute types of all attributes in a entity. My problem is all though this same method has worked in the past it's now throwing this error regardless of the entity I pass in to it.
There was an error while trying to deserialize parameter http://schemas.microsoft.com/xrm/2011/Contracts/Services:ExecuteResult
Here is my code, I'm passing in the "account" entity.
public string GetFieldType(IOrganizationService svc, string entity, string fieldName)
{
RetrieveEntityRequest request = new RetrieveEntityRequest()
{
EntityFilters = EntityFilters.Attributes,
LogicalName = entity
};
RetrieveEntityResponse response = (RetrieveEntityResponse)svc.Execute(request);
string type = "";
foreach (AttributeMetadata attribute in response.EntityMetadata.Attributes)
{
if (attribute.LogicalName == fieldName)
{ type = attribute.AttributeType.ToString(); }
}
return type;
}