Skip to content
KiweelyKiweelyKiweely

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
  • Applies to Workday Query Language
  • 4 min read
  • Published
  • By Kiweely
On this page

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.

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

Related guides

All guides

Let Workday check the work.

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

Get the next guide in your inbox.

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

We’ll email you once to confirm. Unsubscribe in one click from any issue.