1
votes

I'm using Microsoft dynamics 365 - on premises of my client. Here, I am facing an issue in accessing one of the fields - ownerid of type owner.

I am using Web API approach to access the CRM data. When I hit the query in URL, it brings all the data except ownerid column.

It's field type is: Simple

Has anyone faced the same issue with WebAPI query approach?

URL Query:

https://baseURL/moves?$select=moveid,ownerid,movenumber&$filter=movenumber%20eq%20%27236659%27

Output:

{
  "@odata.context":"https://baseURL/$metadata#moves(moveid,ownerid,movenumber)","value":[
    {
      "@odata.etag":"W/\"37655223\"","moveid":"4583b2fe-83d9-e611-80c7-369e029457bb","movenumber":"236659"
    }
  ]
}
1
@ArunVinoth, updated question as per your suggestion with tried approach.Pratik Soni

1 Answers

3
votes

I think ownerid is a lookup, so you need to expand it first by using $expand query parameter, to be included in the response.

https://baseURL/moves?$expand=ownerid&$select=moveid,ownerid,movenumber&$filter=movenumber%20eq%20%27236659%27

Reference: https://docs.microsoft.com/en-us/aspnet/web-api/overview/odata-support-in-aspnet-web-api/using-select-expand-and-value