I'm using Postman to query the Dynamics 365 Web API to fetch Account records. I'm trying to use expand
to fetch some properties from the related SystemUser record via the ownerid
field.
Here is what I think the query should look like:
https://myorg.api.crm4.dynamics.com/api/data/v9.0/accounts?$select=name&$expand=ownerid($select=fullname)
When I submit this query I get the error:
Could not find a property named 'fullname' on type 'Microsoft.Dynamics.CRM.principal
I know that the fullname
property definitely exists on a SystemUser.
If I remove the ($select=fullname)
part of the query I get the following JSON result but I was expect lots of properties for the expanded owner.
{
"@odata.context": "https://myorg.api.crm4.dynamics.com/api/data/v9.0/$metadata#accounts(name,ownerid)",
"value": [
{
"@odata.etag": "W/\"1564360\"",
"name": "My Account",
"accountid": "82b287d6-0dc7-e811-a95e-000d3ab1ab19",
"ownerid": {
"ownerid": "5f8872b1-0189-e811-a975-000d3ab38ab1"
}
}
]
}
If I change the expand
to use primarycontactid
then this works and I can fetch fields from a Contact record.
I've checked the documentation and I'm no further forward.
https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/webapi/query-data-web-api
How do I use expand to fetch properties from a SystemUser record via the ownerid property of Accounts?