Microsoft Edge Try Microsoft Edge A fast and secure browser that's designed for Windows 10 Get started

This site uses cookies for analytics, personalized content and ads. By continuing to browse this site, you agree to this use. Learn more
Microsoft
Dynamics 365 Community
  • Microsoft 365
  • Azure
  • Office 365
  • Dynamics 365
  • SQL
  • Windows 10
      • Windows Server
      • Enterprise Mobility + Security
      • Power BI
      • Teams
      • Visual Studio
      • Surface for Business
      • AI
      • Internet of Things
      • Azure Cognitive Services
      • Quantum
      • Research
      • Docs
      • TechNet
      • Developer Network
      • Windows Dev Center
      • Windows IT Pro Center
      • FastTrack
      • Partner Network
      • Solution Providers
      • Partner Center
      • Cloud Hosting
      • Education
      • Financial services
      • Government
      • Health
      • Manufacturing & resources
      • Retail
      • Security
      • Licensing
      • AppSource
      • Azure Marketplace
      • Events
    • View all
    Sign in
    • Home
      • Sales
      • Customer Service
      • Field Service
      • Talent
      • Finance and Operations
      • Retail
      • Project Service Automation
      • Marketing
      • Business Central
      • General
      • Microsoft Dynamics CRM
      • Microsoft Dynamics AX
      • Microsoft Dynamics NAV
      • Microsoft Dynamics GP
      • Microsoft Dynamics SL
      • Other Products
    AX Forum Ideas
    • Learning Resources
    • Documentation
    • AX Blogs
    • Community News
    • Get Started
    • Introduce Yourself
      • Earn Badges
      • View Badges
      • Compete on Leaderboards
      • View Leaderboards
    • Become an Expert
    • Request a New Blog
    • Provide Feedback
    User Groups

    • Sign In/Sign Up
    • Home
    • Forum
    • Blogs
    • Videos
    • Experts
    • Support
    • Communities
      • Microsoft Dynamics AX
      • Microsoft Dynamics CRM
      • Microsoft Dynamics GP
      • Microsoft Dynamics NAV
      • Microsoft Dynamics SL
      • Other Products
      • Partner Community
      • Envision

    Filter for enum fields in OData service

    • Sign In
    • Home
    • Share
      • Twitter
      • LinkedIn
      • Facebook
      • Email
      • Print
    • RSS
    21 Apr 2017 12:08 PM

    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.

    Read Complete Post and Comments
    Tags: AX 7 Dynamics 365 enum linq LINQ @en OData

    Meet the Author

    Martin Dráb picture
    Martin Dráb
    Works for Freelancer in Czech Republic
    @goshoom
    LinkedIn
    Blog

    About Goshoom. NET Dev Blog

    Martin Dráb's blog about Microsoft Dynamics AX & .NET programming and software engineering in general.

    Microsoft Dynamics AX

    Get help on your Microsoft Dynamics AX solution from qualified experts in the forums, read blogs and how-to articles, and watch videos.
    RSS

    Recommended Content

    Filter OData entity by enum field.
    by ievgen Miroshnikov on 15 Feb 2017
    • 0 comments
    Odata connection/service reference
    by Samuel Liang on 19 Sep 2016
    • Verified Answer
    Updating in Dynamics AX 7 using OData services
    by Manjunath Ingalagi on 26 Nov 2016
    • Not Answered
    Filter Records in Form by using Enum field
    by Alex on 7 Nov 2016
    • Suggested Answer
    OData service across companies
    by Martin Dráb on 20 Apr 2017
    • 0 comments
    View More

    Top Tags

    .NET .NET Interop assembly AX 2012 AX 7 ax2012 Build C# CIL compilation Dynamics 365 Dynamics AX form Integration linq PowerShell SQL sql server Team Foundation Server unit test version management Visual Studio Visual Studio Online WCF Web Service

    What's new

    • Surface Book 2
    • Surface Pro
    • Xbox One X
    • Xbox One S
    • VR & mixed reality
    • Windows 10 apps
    • Office apps

    Store & Support

    • Account profile
    • Download Center
    • Sales & support
    • Returns
    • Order tracking
    • Store locations
    • Support
    • Buy online, pick up in store

    Education

    • Microsoft in education
    • Office for students
    • Office 365 for schools
    • Deals for students & parents
    • Microsoft Azure in education

    Enterprise

    • Microsoft Azure
    • Enterprise
    • Data platform
    • Find a solutions provider
    • Microsoft partner resources
    • Microsoft AppSource
    • Manufacturing & resources
    • Financial services

    Developer

    • Microsoft Visual Studio
    • Windows Dev Center
    • Developer Network
    • TechNet
    • Microsoft Virtual Academy
    • Microsoft developer program
    • Channel 9
    • Office Dev Center

    Company

    • Careers
    • About Microsoft
    • Company news
    • Privacy at Microsoft
    • Investors
    • Diversity and inclusion
    • Accessibility
    • Security
    English (United States)
    • Contact Us
    • Privacy & Cookies
    • Terms of Use
    • Trademarks
    • © Microsoft 2018