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...
Suggested answer

Custom API page returns error "The node count limit of '100' has been exceeded."

(4) ShareShare
ReportReport
Posted on by 18
Hi, 
 
I've created a custom API page to retreive records from a custom table. To get the records I need, I use odata filterexpression, e.g.: 
"startswith(itemNo,'11054') or startswith(itemNo,'11057') or startswith(itemNo,'11058') or startswith(itemNo,'11062') or startswith(itemNo,'11063') or startswith(itemNo,'11064') or startswith(itemNo,'11065') or startswith(itemNo,'11066') or startswith(itemNo,'11081') or startswith(itemNo,'11082') or startswith(itemNo,'11083') or startswith(itemNo,'11084') or startswith(itemNo,'11085') or startswith(itemNo,'11086') or startswith(itemNo,'11115') or startswith(itemNo,'11090') or startswith(itemNo,'11091') or startswith(itemNo,'11104') or startswith(itemNo,'11105') or startswith(itemNo,'11106') or startswith(itemNo,'11107') or startswith(itemNo,'11108') or startswith(itemNo,'11109') or startswith(itemNo,'11110') or startswith(itemNo,'11111') or startswith(itemNo,'11112') or startswith(itemNo,'11140') or startswith(itemNo,'11114') or startswith(itemNo,'11128') or startswith(itemNo,'11129') or startswith(itemNo,'11138')"
The I get the error "The node count limit of '100' has been exceeded. To increase the limit, set the 'MaxNodeCount' property on EnableQueryAttribute or ODataValidationSettings". When I only use 1 or 2 'or' statements it works fine. I found out this is standard Odata behaviour. MaxNodeCount exceeded · Issue #579 · OData/RESTier · GitHub.
 
Is there a possibility to increase the MaxNodeCount? If yes, how and where? Would this be possible in the code of my API page? Or are there other solutions to avoid this problem? I was not able to find any information about this error in combination with Business Cental. 
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    89,830 Super User 2025 Season 2 on at
    Custom API page returns error "The node count limit of '100' has been exceeded."
    Can you simplify your filterexpression? You can try other keywords other than startwith.
     
    Hope this helps as well.
    Thanks.
    ZHU
  • Gerardo Rentería García Profile Picture
    22,524 Most Valuable Professional on at
    Custom API page returns error "The node count limit of '100' has been exceeded."
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    18,797 Super User 2025 Season 2 on at
    Custom API page returns error "The node count limit of '100' has been exceeded."
  • Verified answer
    Sohail Ahmed Profile Picture
    10,958 Super User 2025 Season 2 on at
    Custom API page returns error "The node count limit of '100' has been exceeded."
    You're right — the error you're seeing is caused by exceeding the OData filter complexity limit (MaxNodeCount), which is hardcoded in the Business Central OData stack and cannot be increased or bypassed from within AL code or API Page definitions.
     
    Why it's happening
     
    OData queries like yours with many or startswith() conditions build a complex expression tree, and BC enforces a default node limit of 100 to avoid performance issues. Unfortunately, this value cannot be overridden through any AL-level property (like EnableQueryAttribute), since BC doesn't expose those low-level OData server controls to developers.
     
     
    ---
     
    ✅ Workarounds you can use:
     
    1. Filter with a Custom Field or Table
     
    If you can prepare the list of matching item numbers in advance, you could:
     
    Create a temporary table or blob to store the item numbers.
     
    Use a custom API page that reads from that list and returns the matching results.
     
     
    2. Use $filter with in instead of multiple or startswith()
     
    Business Central OData doesn't support in natively, but if you’re in control of the logic, you can make multiple smaller API calls (e.g., batches of 5 startswith() conditions per call).
     
    3. Use custom AL code to handle input list
     
    Create a custom API that takes a body payload (like JSON array of item numbers) and returns filtered data via a codeunit or query object. This avoids the OData filter altogether.
     
     
    ---
     
    ❌ You cannot:
     
    Increase MaxNodeCount from BC extension code.
     
    Set ODataValidationSettings in AL.
     
    Use web.config or server-side modifications in SaaS (only possible on On-Prem via IIS configs).
     
     
     
    ---
     
    Recommendation (especially for SaaS):
    Build a custom API endpoint (via a codeunit exposed as a web service) that takes a filter payload and returns the matching data programmatically.
     
     
     
    ✅ Mark this answer as verified if it helps you.
     
     

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…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,899 Super User 2025 Season 2

#2
Sumit Singh Profile Picture

Sumit Singh 2,444

#3
Jeffrey Bulanadi Profile Picture

Jeffrey Bulanadi 2,304

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans