Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Blogs / Goshoom. NET Dev Blog / Filter for enum fields in O...

Filter for enum fields in OData service

Martin Dráb Profile Picture Martin Dráb 229,656 Most Valuable Professional

It took me a while to figure out how to filter AX (Operations) enum fields in the URL for OData service (I was using Get records in Flow). For example, let’s say I wanted to get sales orders with status = open order.

After a few failed attempts, I actually used classes generated by OData Client Code Generator, constructed a LINQ query and ran it.

context.SalesOrderHeaders.Where(h => h.SalesOrderStatus == SalesStatus.Backorder).ToArray();

Then I intercepted the URL in an event handler for SendingRequest2 and finally got the answer. The filter must be set in this way:

SalesOrderStatus eq Microsoft.Dynamics.DataEntities.SalesStatus'Backorder'

No wonder I didn’t guess it.


This was originally posted here.

Comments

*This post is locked for comments