---
title: "WQL 500 RBO Instance and Large IN Filter Limits — Kiweely"
description: "How to handle the WQL 500-instance ceiling per Related Business Object row and resolve S24 Internal Error when passing hundreds of IDs in an IN (...) filter."
url: https://kiweely.com/guides/wql-500-rbo-instances-per-row-large-in-filter-limits
---

# WQL 500-Instance Related Business Object Limit and Large IN (...) Filter Limits

WQL enforces a strict limit of 500 instances per multi-instance Related Business Object (RBO) on a single row and fails with S24 Internal Error when filtering large IN (...) lists of 200–600+ Workday IDs. Learn how to invert the PBO, filter by hierarchy, or use RaaS.

-   **Checked** against Workday on November 6
-   Applies to **Workday Query Language**
-   4 min read
-   Published November 6
-   By Kiweely

## The Two Scale Limits That Break Single-Row RBOs and Large `IN (...)` Filters

Developers designing WQL integrations frequently know about WQL’s top-level row limits—up to **10,000 rows per page** via `limit` and `offset`, and up to **1,000,000 rows total**—but hit two lesser-known architectural limits at runtime:

1.  **The 500-Instance Limit per Multi-Instance RBO Field:** Even if a WQL query returns only **1 top-level row**, any multi-instance Related Business Object (`RBO`) field selected with `{...}` curly braces can return a maximum of **500 instances** for that primary row.
2.  **Large `IN (...)` Filter Complexity & Character Limits:** Passing hundreds of individual Workday IDs (for example, 200 to 600+ location or worker WIDs) inside a single `WHERE field IN (...)` clause causes WQL to fail with `code: "S24"`, `error: "Internal error"` or exceed the query character limit.

Understanding how Workday evaluates both constructs lets you redesign the query before it fails in production.

## Limit 1: Maximum of 500 Instances on a Multi-Instance Related Business Object

Suppose you query a supervisory organization, a cost center, or a custom parent business object that returns a single top-level row, and you use RBO `{}` syntax to pull a multi-instance child collection containing thousands of workers or dependents:

sql

```
SELECT supervisoryOrganization, workers{worker, employeeID, businessTitle}
FROM supervisoryOrganizations
WHERE supervisoryOrganization IN (356850fb684a10dec08d71cf278f916d)
```

Although this query returns only 1 top-level row (well under the 10,000-row page limit), **WQL fails with an error whenever the multi-instance RBO lookup field returns more than 500 values for a single primary business object (PBO) row**. As documented in Workday’s *Concept: Related Business Objects in WQL*, Workday supports at most 500 instances per multi-instance RBO field.

### Fix A: Invert the Query so the Child RBO Becomes the Primary Business Object

Instead of querying the parent object as the PBO and traversing the 1-to-many relationship via RBO `{}` braces, switch to a data source where the child record is the **Primary Business Object (PBO)** and filter by the parent instance in the `WHERE` clause:

sql

```
SELECT worker, employeeID, businessTitle, supervisoryOrganization
FROM allWorkers
WHERE supervisoryOrganization IN (356850fb684a10dec08d71cf278f916d)
```

When `Worker` (or `Dependent`, or your child Extend Model Business Object) is the PBO, each child instance is a top-level row. You can now retrieve 10,000 rows per page (up to 1,000,000 rows total) using standard `limit` and `offset` pagination without hitting the 500-instance RBO ceiling.

### Fix B: Use Reports as a Service (RaaS) When PBO Inversion Is Not Possible

If no Workday data source exposes the child object as a PBO, build a custom Advanced Report and expose it via **Reports as a Service (RaaS)**. Unlike WQL, RaaS does not cap multi-instance related business object collections at 500 values per row.

## Limit 2: `S24 Internal Error` When Filtering 200–600+ IDs in `WHERE ... IN (...)`

A second failure occurs when an application maps a user’s selection (for example, 20 jurisdictions that expand to 600 individual `Location` Workday IDs) into a massive `WHERE location IN (...)` filter:

sql

```
SELECT worker, employeeID, location, totalBasePay_Amount
FROM indexedAllWorkers (dataSourceFilter = indexedAllWorkersFilter)
WHERE location IN (
  356850fb684a10dec08d71cf278f916d,
  356850fb684a10dec08d7a46a6779177,
  /* ... 600+ 32-character WIDs ... */
  356850fb684a10dec08da9b8110791ae
)
```

While this query succeeds for 10 or 20 locations, passing 200 to 600+ Workday IDs fails with HTTP 500 / 400:

json

```
{
  "error": "Internal error",
  "code": "S24",
  "caseId": "a00f404e-d514-4ba5-be87-2af95c837252"
}
```

In addition, if a dynamic script interpolates an empty array into an `OR` condition—producing invalid syntax such as `WHERE (locationHierarchy IN () OR location IN (...))`—WQL rejects the empty `IN ()` list.

### Fix A: Filter by Hierarchy or Parent Attribute Instead of Leaf WIDs

Never enumerate hundreds of leaf location, cost center, or organization WIDs when those instances belong to a parent hierarchy or share an attribute:

-   Filter by **Location Hierarchy** (`locationHierarchy` or `locationHierarchies`) instead of 600 individual `location` WIDs.
-   If the grouping is defined in an Extend object or custom mapping, stamp a **Custom Organization** or **Calculated Field** (such as `cf_CFLRVTerritoryOfWorker` or primary work address state) onto the worker and filter on those 10–20 parent jurisdiction values directly.

### Fix B: Guard Empty `IN ()` Clauses and Chunk Large ID Lists

If you must filter by an arbitrary list of Workday IDs that do not share a hierarchy:

1.  **Never emit an empty `IN ()` clause:** In PMD or Orchestrate, check whether the array of IDs is non-empty before appending `field IN (...)` to the `WHERE` string.
2.  **Watch the character ceiling:** 45 Workday IDs (each 32 chars plus quotes and commas) add over 1,600 characters, pushing `GET /wql/v1/data` over its **2,048-character URL limit**. Switching to `POST /wql/v1/data` raises the character ceiling to **16,000 characters** (~400 WIDs), but very large `IN` lists can still hit WQL filter tree complexity limits (`S24`).
3.  **Chunk in batches of 100–150 IDs:** In an Orchestration loop, partition large ID lists into chunks of 100–150 WIDs per `POST /wql/v1/data` request and aggregate the responses.

## How to Verify in the Tenant

1.  Open **View WQL Query Result** in the tenant and test your query with a high-volume parent record (for example, a supervisory organization or location with more than 500 workers).
2.  Confirm that querying `workers{...}` as an RBO fails once the child count exceeds 500, whereas querying `FROM allWorkers WHERE supervisoryOrganization IN (...)` returns the full population cleanly.
3.  For dynamic `IN (...)` filters, test both boundary cases in your PMD or Orchestrate script: when a user selects `0` items (ensuring `IN ()` is omitted from the generated WQL) and when a user selects the maximum number of items.

## Sources checked

-   [Concept: Related Business Objects in WQL](https://developer.workday.com/documentation/GUID-5295e235-6d69-4b80-ad51-510afbdfb853-enHYPHENus)
-   [Reference: WQL Result Limits](https://developer.workday.com/documentation/GUID-98ecf957-d369-4439-b541-ae8be7844401)
-   [WQL Reference: WHERE](https://developer.workday.com/documentation/GUID-a9f9f945-baf1-4a7d-9118-db9a8ce49265-enHYPHENus)
-   [Reference: WQL and RaaS Comparisons](https://developer.workday.com/documentation/GUID-8f1d3acf-87ba-4de7-9dc5-84e3991be6a2-enHYPHENus)

## Related guides

[All guides](https://kiweely.com/guides)

-   [### Paging with POST /wql/v1/data in a PMD Grid When Queries Exceed URL Limits Switching a PMD grid endpoint from GET /wql/v1/data to POST /wql/v1/data when a WQL query exceeds 2,048 characters causes HTTP 500 when native grid pagingInfo is enabled. Learn why PMD grid paging fails with POST and three working architectures to paginate long queries.](https://kiweely.com/guides/wql-post-data-endpoint-grid-pagination-url-limit)
-   [### Filtering Empty Related Business Objects in WQL and Guarding Omitted RBO Keys in PMD Checking whether a context-linked Related Business Object (RBO) is empty in a WQL WHERE clause can throw “Field: ... can only be used as a related business object field (RBO)”, and empty RBOs are omitted entirely from WQL JSON responses. Learn how to filter empty RBOs and guard PMD scripts.](https://kiweely.com/guides/wql-check-rbo-empty-missing-json-keys-pmd)
-   [### What is Workday Query Language (WQL), and how do you write and run a query? Workday Query Language (WQL) is Workday’s SQL-like language for reading data from data sources and fields instead of reports. You need the Workday Query Language domain in the System functional area; an external caller also needs an API client with System scope.](https://kiweely.com/guides/workday-wql)
-   [### How do I get more than 500 rows from a Workday WQL query? The 500-row stop belongs to the View WQL Query Result report. The WQL REST API returns up to 10,000 rows per page: pass limit (0 to 10,000) and offset. A worked run pages 48,491 rows in five calls, with Workday’s exact errors for a limit above 10,000 and an offset past the end.](https://kiweely.com/guides/wql-more-than-500-rows)

### More guides on WQL

[All 31 guides](https://kiweely.com/guides#wql)

-   [Fixing WQL HTTP 400 “Parms are required for the fields or data source in the query”](https://kiweely.com/guides/wql-400-parms-are-required-for-fields-or-data-source)
-   [Custom Agent Actions that call Workday SOAP, REST and WQL](https://kiweely.com/guides/workday-custom-agent-actions-soap-rest-wql)
-   [Running WQL in Orchestrate as an integration system user: the security it needs](https://kiweely.com/guides/workday-orchestrate-wql-as-isu)
-   [WQL Cheat Sheet: Workday Query Language Syntax, Data Sources and Working Examples](https://kiweely.com/guides/workday-wql-cheat-sheet)
-   [Workday Prism Analytics vs. WQL vs. Custom Reports: Joining External and Tenant Data](https://kiweely.com/guides/workday-prism-analytics-vs-wql)
-   [Should I use RaaS, WQL or the REST API to extract data from Workday?](https://kiweely.com/guides/workday-raas-wql-rest)
-   [Why does my Workday WQL query fail? The exact error messages and how to fix each one](https://kiweely.com/guides/wql-error-messages)
-   [Why does WQL return 403 permission denied S22 for an ISU?](https://kiweely.com/guides/workday-wql-403-s22-as-isu)

### From the blog on WQL

[All posts](https://kiweely.com/blog)

-   [Answering Executive Span-of-Control and Headcount Questions Live from Workday](https://kiweely.com/blog/executive-org-span-of-control-attrition-questions-live-workday)
-   [Build vs. Buy a Workday MCP Server: OAuth 2.1, SOAP, WQL, and Twice-Yearly Releases](https://kiweely.com/blog/build-vs-buy-workday-mcp-server-engineering-cost)
-   [What happens after ChatGPT writes your WQL query](https://kiweely.com/blog/after-chatgpt-writes-your-wql)

## Let Workday check the work.

Kiweely writes WQL and builds orchestrations in your own tenant, and Workday, not Kiweely, says whether they passed.

[Start for free](https://kiweely.com/download) [See how it works](https://kiweely.com/vine/how-it-works)

## Get the next guide in your inbox.

One email a month with new guides and one Extend tip. Nothing else.
