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.
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() DESCYou 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 withORDER BY count() descboth appear in Workday’s examples.- Dates in
WHEREuse theYYYY-MM-DDformat inside quotes. - Instance fields like worker type can only be filtered with
in,not in,is emptyoris not empty, not with=. The syntax for matching by reference ID isfield 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:
- Field names:
supervisoryOrganization,hireDateandworkerTypeare my best guesses. CallGET /dataSources/{allWorkers id}/fieldsto get the real names. - “Active”: I’m assuming
allWorkersonly returns current workers, since terminated workers are in a separate “active and terminated” data source. Check this in your tenant. If you have anallActiveEmployeesdata source, use it instead and drop theworkerTypeline. - Employee filter: The reference ID type and value in
Worker_Type_ID = Employeeare placeholders. Look up the actual ones, or use the Workday ID of the Employee worker type, for exampleworkerType in (abc123...). - Grouping on the org field:
GROUP BYdoesn’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. - Hire date:
hireDateis 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:
- WQL WHERE clause
- WQL SELECT clause / aggregations
- WQL HAVING / GROUP BY example
- WQL FROM clause
- WQL overview
- Visier – Workday Query Language (group by limitations)
- Workday WQL query usage guidelines (Prism export)
- StackOne Workday WQL guide
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
SELECT workerType, COUNT() AS workers
FROM allWorkers
GROUP BY workerTypeEach 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
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() DESCPut 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:
SELECT workerType, COUNT() AS workers
FROM allWorkers
GROUP BY workerType2. Find the Employee row in the response. It will look roughly like this:
{"workerType": {"descriptor": "Employee", "id": "3c8f0a1b2d4e5f60718293a4b5c6d7e8"}, "workers": 1234}3. Copy that id value (32 characters) into the main query without quotes:
SELECT supervisoryOrganization, COUNT() AS newHires
FROM allWorkers
WHERE hireDate >= '2025-01-01'
AND workerType in (3c8f0a1b2d4e5f60718293a4b5c6d7e8)
GROUP BY supervisoryOrganization
ORDER BY COUNT() DESCThe 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.