web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Issue with Filtering on Custom Field in Business Central API

(5) ShareShare
ReportReport
Posted on by 10

Hello Everyone,
 

I am facing an issue while retrieving records from the custom API page in Business Central.

When we use Get Record by ID, the custom field (SageNo) is returned correctly in the response.

However, when we try to retrieve the same record using $filter on the SageNo field, the record is not returned for certain values. Interestingly, filtering works for some SageNo values but fails for others, even though:


  • The field exists in the API pag

  • The value is present in the record

  • The same company and environment are being used

  • The same filter syntax is applied
     

  • Example:

  • GET by ID → Record is returned and SageNo is visible

  • GET with $filter=SageNo eq '161129' → No record found (for some values)

  • Filtering works for other SageNo values


  •  
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    100,974 Super User 2026 Season 1 on at
    That's a bit strange. Can you find it using the IN operator?
    PS: Dynamics 365 Business Central: How to use the OData V4 IN operator in web service queries
     
    Thanks.
    ZHU
  • Suggested answer
    OussamaSabbouh Profile Picture
    16,074 Super User 2026 Season 1 on at
    Hello,
    This is almost always an exact-match issue with OData filtering — $filter=SageNo eq '161129' only returns a record if the stored value matches exactly. If SageNo is a Text field, some records may contain hidden characters (leading/trailing spaces or special characters), so GET by ID shows the value but $filter doesn’t match it. If it’s a Code field, BC trims spaces and uppercases automatically, which avoids most of these problems. Also make sure you’re filtering with the correct data type (quotes for Text/Code, no quotes for numeric fields). A quick test is to try contains(SageNo,'161129') — if that works, it confirms a formatting/whitespace issue rather than an API or environment problem.
    Regards,
    Oussama Sabbouh

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,086 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,290 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,218

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans