Please read the follows and tell me what I did wrong.
The request I sent:
https://gravityrush.crm5.dynamics.com/api/data/v9.1/accounts?$expand=ownerid/$ref
The response I expected:
"ownerid":{
"@odata.type":"#Microsoft.Dynamics.CRM.systemuser",
"@odata.id":"https://gravityrush.crm5.dynamics.com/api/data/v9.0/systemusers(41041b99-e1ae-46c6-a10c-95ce77fc0b18)"
}
The response I received:
"ownerid":{
"@odata.type":"#Microsoft.Dynamics.CRM.systemuser",
"@odata.id":"https://gravityrush.crm5.dynamics.com/api/data/v9.1/owners()"
}
Thank you.
I think it's possibly a limitation/bug related to this field type.
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 calledOwner
, and that's why you're getting the owners() url:I tried to workaround this using the
owninguser
andowningteam
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: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:https://orgurl/api/data/v8.2/accounts()?$select=_ownerid_value
You will get OwnerId of each account Record.