过滤OData请求时,我无法检索查找字段。
我使用了以下请求:
https://mycrm.api.crm4.dynamics.com/api/data/v9.1/contacts(guid)?$select=contactid,ownerid,createdby,new_expirefin,new_testcumul_stat```
此请求检索contactid,new_expirefin和new_testcumul_stat,但没有ownerid和createdby的跟踪。
另一方面,这个要求:
https://mycrm.api.crm4.dynamics.com/api/data/v9.1/contacts(guid)
返回所有字段,包括其他请求中缺少的字段。查找作为Guid发送。
两个请求都使用了
Prefer = odata.include-annotations="*"
头。知道我不知道哪个列是查找(我正在研究通用库),我怎么能检索那些查找?
使用_lookupName_value
格式可以检索查找:
https://myOrg.api.crm.dynamics.com/api/data/v9.1/contacts(guid)?$select=contactid,fullname,_ownerid_value,_createdby_value
这当然留下了解哪些字段是查找因此需要这种格式化的问题。
这有助于:
https://myOrg.api.crm.dynamics.com/api/data/v9.1/EntityDefinitions(LogicalName='contact')?$select=LogicalName&$expand=ManyToOneRelationships($select=ReferencingAttribute,ReferencedEntity)