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

Community site session details

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

Business Central Odata Endpoint with multiple Contains()

(0) ShareShare
ReportReport
Posted on by 2

Hello Everyone,

I'm currently working on querying the OData v4 /Customer endpoint for Business Central in order to retrieve customers based on a user's search criteria for either name or customer number.

I can successfully make a call to:

https:/api.businesscentral.dynamics.com/v2.0/{_businessCentralOptions.TenantId}/{_businessCentralOptions.Environment}/ODataV4/Company('{_businessCentralOptions.CompanyName}')/Customer


This call retrieves all customers, and I can narrow down the results by adding a filter, for example:

/Customer?$filter=contains(Search_Name,'TESTING')
However, I encountered an issue when attempting to search through both the Search_Name and No fields simultaneously, like this:
 
/Customer?$filter=contains(Search_Name,'TESTING') or contains(No,'50000')
 

This query returns a 501 not implemented error.

In my testing, I found that chaining multiple contains together works if I'm searching within the same field:

/Customer?$filter=contains(Search_Name,'TESTING1') or contains(Search_Name,'TESTING2')
My question is: How can I perform a search on both the Search_Name and No fields simultaneously? I came across an article suggesting the use of the $search option, but it seems to be ignored in my case. Any guidance on this matter would be greatly appreciated.
 
I have the same question (0)
  • Verified answer
    YUN ZHU Profile Picture
    93,438 Super User 2025 Season 2 on at
    Business Central Odata Endpoint with multiple Contains()
    Hi, as far as I know, the 'OR' operator does not support different fields.
    More details:
    "message": "The 'OR' operator is not supported on distinct fields on an OData filter.  CorrelationId:  6b597f3e-4e78-4442-96e6-1222475cb8ab."
     
    In addition, it may be easy to do in the database, but this is also a very special process in AL Language.
    Dynamics 365 Business Central: Cross-column search (OR filters on multiple fields) ★FilterGroup(-1)
     
    Hope this helps.
    Thanks.
    ZHU

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
Sumit Singh Profile Picture

Sumit Singh 2,674

#2
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 2,580

#3
YUN ZHU Profile Picture

YUN ZHU 2,115 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans