Replicating HR Partner Hub organization hierarchy filtering in WQL
When building a manager or HR Partner dashboard in Workday Extend, filtering a staffing or worker data source with WHERE ON worker manager_Level01 IN (<% me %>) only returns direct reports of the logged-in user. It does not return workers across the Supervisory Organizations, Cost Center Hierarchies, or subordinate reporting trees where the logged-in user holds a constrained role such as HR Partner, HR Executive, or Compensation Partner.
To retrieve all workers across the organizations (and subordinate organization hierarchies) assigned to the current user’s role, use the workersForHCMReporting data source with the workersByRole data source filter and pass the Role-Based Security Group workdayID in the roles parameter:
SELECT workdayID AS id,
legalFullName AS descriptor,
supervisoryOrganization,
organizationAndSuperiorOrganizations
FROM workersForHCMReporting (
dataSourceFilter = workersByRole,
roles = (daccab9f1d250156228972696b57e0a5),
removeExcludeFromHeadcount = false,
active = true,
includeTerminatedWorkers = false
)Because workersByRole evaluates Workday’s organization role assignments natively on the data source, it automatically includes workers in both the directly assigned Supervisory Organizations and any subordinate organizations inherited down the hierarchy, matching the population shown in the delivered HR Partner Hub.
Guarding workersByRole against hard errors for non-role personas
The workersByRole data source filter has a strict runtime prerequisite: if a user who does not hold the specified role-based security group (or does not have access to run workersByRole) opens the Presentation Metadata (PMD) page under authType: "sso", Workday throws a hard endpoint error that blocks the entire page from rendering.
To prevent the page from crashing when accessed by general employees, line managers, or other personas, split the lookup into two chained inbound endpoints in your .pmd file:
- Endpoint 1 (
workerRoleCheck): QueryworkersForHCMReporting (dataSourceFilter = allActiveWorkers)for the logged-in user (workerDataSelf.id) and select a True/False Calculated Field (cf_CFTFRoleIsHRPartner) that evaluates whether the current worker holds the target role. - Endpoint 2 (
workersInSupportedOrgs): Add an"exclude"property bound to<% !workerRoleCheck.data[0].cf_CFTFRoleIsHRPartner %>so theworkersByRolequery is skipped whenever the logged-in user does not hold the role.
{
"endPoints": [
{
"name": "workerDataSelf",
"baseUrlType": "workday-staffing",
"url": "workers/me",
"authType": "sso"
},
{
"name": "workerRoleCheck",
"baseUrlType": "WORKDAY-WQL",
"url": "<% '/data?query=' + string:urlEncode('SELECT worker, cf_CFTFRoleIsHRPartner FROM workersForHCMReporting (dataSourceFilter = allActiveWorkers) WHERE worker IN (' + workerDataSelf.id + ')') %>",
"authType": "sso"
},
{
"name": "workersInSupportedOrgs",
"exclude": "<% empty(workerRoleCheck.data) || !workerRoleCheck.data[0].cf_CFTFRoleIsHRPartner %>",
"baseUrlType": "WORKDAY-WQL",
"url": "<% '/data?query=' + string:urlEncode('SELECT workdayID AS id, legalFullName AS descriptor FROM workersForHCMReporting (dataSourceFilter = workersByRole, roles = (daccab9f1d250156228972696b57e0a5), removeExcludeFromHeadcount = false, active = true, includeTerminatedWorkers = false)') %>",
"authType": "sso"
}
]
}Querying Cost Center, Cost Center Hierarchy, GL Account, and GL Account Hierarchy in WQL
When building financial or organization prompt dropdowns (instanceList widgets) on an Extend page, individual organizations and organization hierarchies live in separate WQL data sources and organization types:
- Cost Centers and Cost Center Hierarchies: Both Cost Centers and Cost Center Hierarchies can be queried from
topLevelOrganizations(ororganizations) by filteringtype1(Organization Type) to the tenant’sOrganization_Type_IDWID for Cost Center versus Cost Center Hierarchy, or by queryingcostCenterHierarchies/costCentersreporting data sources directly:
-- Individual Cost Centers via topLevelOrganizations
SELECT workdayID, name, code, type1
FROM topLevelOrganizations
WHERE type1 IN ('<Cost_Center_Organization_Type_WID>')
-- Cost Center Hierarchies via topLevelOrganizations
SELECT workdayID, name, code, type1, superiorOrganization, subordinateOrganizations
FROM topLevelOrganizations
WHERE type1 IN ('<Cost_Center_Hierarchy_Organization_Type_WID>')- Ledger Accounts and Ledger Account Summaries (GL Account Hierarchies): Individual GL accounts are queried from
ledgerAccounts. To query GL Account Hierarchies (Ledger Account Summaries), use theledgerAccountSummariesdata source or convert a custom report built on the Ledger Account Summary business object using the Convert Report to WQL task:
-- Individual GL Accounts
SELECT workdayID, ledgerAccount, ledgerAccountName, ledgerAccountTypes
FROM ledgerAccounts
-- GL Account Hierarchies (Ledger Account Summaries)
SELECT workdayID, ledgerAccountSummary, superiorLedgerAccountSummary
FROM ledgerAccountSummariesIf you are unsure which WQL alias corresponds to a specific hierarchy data source or organization type WID in your tenant, create a 2-column custom report on that business object in Workday and run Convert Report to WQL to copy the exact FROM data source alias, dataSourceFilter, and Organization_Type WID.
How to verify the fix in your tenant
- Run Convert Report to WQL on a test report using the Workers for HCM Reporting data source and the Workers by Role filter to obtain your tenant’s exact Role-Based Security Group WID for
roles = (...). - Proxy in as an HR Partner who holds that constrained role and open your Extend page. Confirm that
workersInSupportedOrgsexecutes and returns workers from both the directly assigned Supervisory Organizations and their subordinate organizations. - Proxy in as a standard employee who does not hold the HR Partner role and open the same page. Confirm that
workerRoleCheck.data[0].cf_CFTFRoleIsHRPartnerevaluates tofalse,workersInSupportedOrgsis excluded cleanly, and the page loads without throwing a WQL access error.