如何选择Dynamics CRM参考属性? [英] How do I select Dynamics CRM reference attributes?

查看:58
本文介绍了如何选择Dynamics CRM参考属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请阅读以下内容,并告诉我我做错了什么.

Please read the follows and tell me what I did wrong.

我发送的请求:

https://gravityrush.crm5.dynamics.com/api/data/v9.1/accounts?$expand=ownerid/$ref

我期望的答复:

"ownerid":{
   "@odata.type":"#Microsoft.Dynamics.CRM.systemuser",
   "@odata.id":"https://gravityrush.crm5.dynamics.com/api/data/v9.0/systemusers(41041b99-e1ae-46c6-a10c-95ce77fc0b18)"
}

我收到的回复:

"ownerid":{
   "@odata.type":"#Microsoft.Dynamics.CRM.systemuser",
   "@odata.id":"https://gravityrush.crm5.dynamics.com/api/data/v9.1/owners()"
}

谢谢.

推荐答案

我认为这可能是与此字段类型相关的限制/错误.

I think it's possibly a limitation/bug related to this field type.

您知道, ownerid 字段可以指向 systemuser team 记录,如果您查看该字段定义,您会看到这种关系实际上是与名为 Owner 的实体建立的,这就是为什么要获取owners()url的原因:

As you know, the ownerid field can point to a systemuser or team record, and if you take a look at the field definition you'll see that the relationship is actually to an entity called Owner, and that's why you're getting the owners() url:

"@odata.id":"/api/data/v9.1/owners()"

我尝试使用 owninguser owningteam 字段来解决此问题,但似乎也存在问题,因为当我添加$ ref时,我开始得到将该字段的值设为空:

I tried to workaround this using the owninguser and owningteam fields, but it looks like there's an issue there as well because when I added the $ref I started to get nulls values for that field:

GET /api/data/v9.1/accounts?$select=accountid&$expand=owninguser($select=systemuserid)

"owninguser":{
   "systemuserid":"f30a6a42-3067-4c78-b348-9cbc56531f5e",
   "ownerid":"f30a6a42-3067-4c78-b348-9cbc56531f5e"
}


GET /api/data/v9.1/accounts?$select=accountid&$expand=owninguser/$ref
"owninguser":null

可以肯定的是,我尝试对 Customer 字段执行相同的操作(相同的原则,该字段可以指向联系人帐户记录),但我没有发现此问题,您可以使用以下查询获取对客户/联系人的引用:

Just to be sure, I tried to do the same for a Customer field (kind of same principle where this field can point to a contact or account record) but I din't found this issue, you can get the reference to the Account/Contact using the following query:

GET /api/data/v9.1/incidents?$select=incidentid&$expand=customerid_account/$ref, customerid_contact/$ref

这篇关于如何选择Dynamics CRM参考属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆