【问题标题】:CRM error while trying to deserialize parameter尝试反序列化参数时出现 CRM 错误
【发布时间】:2012-12-06 02:59:23
【问题描述】:

我有一个 CRM 函数,它返回实体中所有属性的属性类型。我的问题是尽管过去同样的方法有效,但现在无论我传递给它的实体如何,它都会抛出这个错误。

尝试反序列化参数http://schemas.microsoft.com/xrm/2011/Contracts/Services:ExecuteResult时出错

这是我的代码,我正在传递“帐户”实体。

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;
        }

【问题讨论】:

  • 你在使用早期绑定实体吗?

标签: c# dynamics-crm-2011 xrm


【解决方案1】:

如果代码以前可以正常工作,而现在不能正常工作,那么很可能不是您的代码有问题。您的svc.Execute 很可能失败了。您是否更改了 IOrganizationService 的创建方式?您是否以有权查询 CRM 实例的用户身份运行?如果所有这些事情都检查出来,那么请尝试通过diagnostic tool 打开服务器端跟踪。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-08
    相关资源
    最近更新 更多