SAP Knowledge Base Article - Public

2790852 - How to retrieve the subordinates of an HR Manager - SuccessFactors OData

Symptom

You need to perform an OData call which would return you the subordinates of an HR Manager.

Environment

  • SuccessFactors
  • OData

Resolution

Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.

There are two entities which can store the HR Manager of a user:

  • User;
  • EmpJobRelationships.

The field which stores this information in the User entity is "hrReports". A query can be easily made on User entity filtering by this value, which would return the subordinates of that filtered HR Manager.

Example:
odata/v2/User?$select=userId,hrReports&$filter=hrReports eq 'HRADMIN'

This query would return all the users related to the HR Manager "HRADMIN".

However, be aware that the HR Manager that is shown in the user profile UI (as you can see below) is not stored in the User entity, but in the EmpJobRelationships entity:

hrreports_1.jpg

In the EmpJobRelationships entity, "relUserId" is the field that has the value of the HR Manager from the user's profile page, and "userId" is the user himself.

This can be user to filter the subordinates of an HR Manager as well.

Example:
odata/v2/EmpJobRelationships?$select=userId,relUserId&$filter=relUserId eq 'HRADMIN'

This query would return all the users related to the HR Manager "HRADMIN" as well.

Keywords

successfactors, success, factors, odata, query, hr, manager, direct, report, inferior, employee, hrreports, reports, api, call, relationship, relation, EmpJobRelationships, Job, Relationships, filter, search, fetch , KBA , LOD-SF-INT , SF Integrations - EC Payroll, Boomi/ HCI, API , LOD-SF-INT-ODATA , OData API Framework , How To

Product

SAP SuccessFactors HCM Suite all versions