Skip to content
KiweelyKiweelyKiweely

T6 · CL · Claude: Anthropic Claude Opus 5.5 (effort high) via Claude Code CLI

On this page

Turn 1: prompt (sent 2026-11-20T04:49:41.831Z)

Write me a WQL query I can run against our Workday tenant (through Workday’s WQL REST API) that returns, for each supervisory organization, the number of active employees hired on or after 1 January 2025, with the largest count first. Organizations with none can be left out.

Turn 1: answer (2026-11-20T04:50:52.054Z, 70.2 s)

I checked Workday’s WQL reference. The overall shape of this query is right, but I couldn’t confirm the field names, which vary by tenant.

sql
SELECT supervisoryOrganization, COUNT() AS newHires
FROM allWorkers
WHERE hireDate >= '2025-01-01'
  AND workerType in (Worker_Type_ID = Employee)
GROUP BY supervisoryOrganization
ORDER BY COUNT() DESC

You can run it through the REST API’s /data endpoint by passing it as the query parameter. It’s under 2,048 characters, so a GET works.

What the documentation confirms:

  • COUNT() takes no arguments. Grouping and then sorting with ORDER BY count() desc both appear in Workday’s examples.
  • Dates in WHERE use the YYYY-MM-DD format inside quotes.
  • Instance fields like worker type can only be filtered with in, not in, is empty or is not empty, not with =. The syntax for matching by reference ID is field in (Ref_ID_Type = value).
  • Organizations with zero matching employees won’t appear. Grouping only produces rows for groups that have at least one record, so you don’t need extra filtering.

What you should check against your tenant:

  1. Field names: supervisoryOrganization, hireDate and workerType are my best guesses. Call GET /dataSources/{allWorkers id}/fields to get the real names.
  2. “Active”: I’m assuming allWorkers only returns current workers, since terminated workers are in a separate “active and terminated” data source. Check this in your tenant. If you have an allActiveEmployees data source, use it instead and drop the workerType line.
  3. Employee filter: The reference ID type and value in Worker_Type_ID = Employee are placeholders. Look up the actual ones, or use the Workday ID of the Employee worker type, for example workerType in (abc123...).
  4. Grouping on the org field: GROUP BY doesn’t work on multi-instance fields. If your supervisory org field is multi-instance, use the field for the primary position’s org, or a calculated field.
  5. Hire date: hireDate is usually the most recent hire date, so rehires since 2025 will be counted. Use an original hire date field if you don’t want that.

Sources:

Turn 2: follow-up (sent 2026-11-20T05:21:13.228Z)

{“error”:”invalid request: WQL error.”,”errors”:[{“error”:”cannot resolve instance Employee”,”field”:”[248 223 237 220 93 80]”,”severity”:”Critical”,”location”:”Invalid WHERE clause”}]}

Turn 2: answer (2026-11-20T05:21:24.888Z, 11.7 s)

That error means WQL couldn’t find a worker type with the reference ID Employee. The Worker_Type_ID = Employee part was a placeholder, and it doesn’t match anything in your tenant. Only the WHERE clause was flagged, so the other field names probably resolved. WQL may stop at the first error, though, so that isn’t certain yet.

The most reliable fix is to filter on the worker type’s Workday ID (WID), which you can get from WQL itself.

Step 1: Find the WID for the Employee worker type

sql
SELECT workerType, COUNT() AS workers
FROM allWorkers
GROUP BY workerType

Each instance field in the JSON response includes a descriptor, such as "Employee", and an id, which is a 32-character WID. Copy the id from the Employee row.

Step 2: Run the original query with that WID

sql
SELECT supervisoryOrganization, COUNT() AS newHires
FROM allWorkers
WHERE hireDate >= '2025-01-01'
  AND workerType in (PASTE_EMPLOYEE_WID_HERE)
GROUP BY supervisoryOrganization
ORDER BY COUNT() DESC

Put the WID in without quotes, the same way the documentation’s worker in (3895af79...) example does.

If Step 1 fails: either workerType isn’t the right field name, or it can’t be grouped on. Call GET /dataSources/{allWorkers id}/fields and look for a worker type field, or for a yes/no field like “Is Employee”. A yes/no field can be filtered with = true, so you wouldn’t need a WID.

If Step 2 then fails on supervisoryOrganization or hireDate: those field names need fixing too. The same /fields call will show what they’re called in your tenant.

Turn 3: follow-up (sent 2026-11-20T05:21:34.951Z)

{“error”:”invalid request: WQL error.”,”errors”:[{“error”:”cannot resolve instance PASTE_EMPLOYEE_WID_HERE”,”field”:”[248 223 237 220 93 80]”,”severity”:”Critical”,”location”:”Invalid WHERE clause”}]}

Turn 3: answer (2026-11-20T05:21:41.742Z, 6.8 s)

The placeholder PASTE_EMPLOYEE_WID_HERE went into the query as-is. It needs to be replaced with your tenant’s real Workday ID for the Employee worker type, and you can only get that ID by running the lookup query first. This error is the same kind as the last one and doesn’t point to any new problem.

1. Run this query first:

sql
SELECT workerType, COUNT() AS workers
FROM allWorkers
GROUP BY workerType

2. Find the Employee row in the response. It will look roughly like this:

json
{"workerType": {"descriptor": "Employee", "id": "3c8f0a1b2d4e5f60718293a4b5c6d7e8"}, "workers": 1234}

3. Copy that id value (32 characters) into the main query without quotes:

sql
SELECT supervisoryOrganization, COUNT() AS newHires
FROM allWorkers
WHERE hireDate >= '2025-01-01'
  AND workerType in (3c8f0a1b2d4e5f60718293a4b5c6d7e8)
GROUP BY supervisoryOrganization
ORDER BY COUNT() DESC

The ID above is made up, so use the one from your own response. If the lookup query in step 1 gives an error or doesn’t return an Employee row, paste the response here and I’ll adjust the query.