【问题标题】:CRM Restkit oData call to retrieve custom entity's value in crm 2011CRM Restkit oData 调用以在 crm 2011 中检索自定义实体的值
【发布时间】:2013-01-07 11:00:48
【问题描述】:
在 crm 2011 中,在实体中,我必须通过 CRM Restkit 从自定义实体中检索名字字段。
运行代码时出现错误。
我认为“过滤器”是错误的。
如果是系统实体,则filter = "ContactId eq guid'"+Xrm.Page.data.entity.attributes.get('xyz' ).getValue( )[0].id+"'" ;
工作正常。
但我的情况是,它是一个自定义实体,模式名称为“new_student”,
我试过 filter = "new_student/Id eq guid'"+Xrm.Page.data.entity.attributes.get('xyz' ).getValue( )[0].id+"'";
这不起作用。
那么在我的情况下过滤器应该是什么
问候,
维克拉姆
【问题讨论】:
标签:
dynamics-crm-2011
dynamics-crm
【解决方案1】:
您可能不应该使用实体名称作为过滤器中的前缀“new_student/Id”。但话虽如此,我建议您通过几个步骤“调试”这个问题。
首先在 JSON 端点打开“new_student”JSON 提要 URL,以查看通过 Web 服务对您的自定义实体有效的所有内容,例如:
http://yourCRMServer/YourInstanceName/2011/OrganizationData.svc/new_studentSet
只需替换 CRM 服务器 URL 和实例名称。
当您使此路径正常工作并看到“结果”时,继续将过滤器添加到 URL 以帮助您识别字段名称并更快地找到正确的过滤器:
http://yourCRMServer/YourInstanceName/2011/OrganizationData.svc/new_studentSet?$filter=Your_Schema_Field_Name eq 'Johnson'
以此类推,如果您只需要名字,则应将其添加到 $select 以最小化来自 JSON Web 服务的数据负载:
http://yourCRMServer/YourInstanceName/2011/OrganizationData.svc/new_studentSet?$filter=Schema_Field_Name eq 'Johnson'&$select=FirstName
希望对你有帮助。