Adam Skinner
Adam Skinner

Reputation: 897

OData query to filter a collection based on a navigation property's expanded value

I have a quotes collection I'd like to filter through a navigation property value. This navigation property is not a collection, but rather the id to another discrete linked entity.

My use case is {{ crmApiBaseUrl }}/quotes?$expand=fs_NAVIntegrationMarkerId&$filter=fs_NAVIntegrationMarkerId/fs_name eq 'Open'

I want to see all of the quotes where the associated fs_NAVIntegrationMarkerId's fs_name property value is equal to 'Open'.

The above query returns "The Property (0) is not a primary key of the related entity".

Upvotes: 1

Views: 1240

Answers (2)

Corey Sutton
Corey Sutton

Reputation: 144

Take a look at the Microsoft Docs reference for options to apply to expanded tables. It has great examples of how to apply a filter to an expanded table that are specific to the Dynamics Web API.

{{crmApiBaseUrl}}/quotes?$expand=fs_NAVIntegrationMarkerId($filter=fs_name eq 'Open')

Upvotes: 0

Kennedy Kangethe-MS
Kennedy Kangethe-MS

Reputation: 21

Try

{{ crmApiBaseUrl }}/quotes?$expand=fs_NAVIntegrationMarkerId($filter=fs_name eq 'Open')

Checkout the Nested filter in expand from this documentation https://www.odata.org/getting-started/basic-tutorial/#filter

Upvotes: 1

Related Questions