Is there a way to calculate 'number of direct reports' by aggregating manager across accounts? Skip to main content
https://support.okta.com/help/answers?id=9062a000000xamoqa0&refurl=http%3a%2f%2fsupport.okta.com%2fhelp%2fanswers
How satisfied are you with the Okta Help Center?
Thank you for your feedback!
How satisfied are you with the Okta Help Center?
1
2
3
4
5
Very Dissatisfied
Very satisfied
Enter content less than 200 characters.
Ask Search:
Pablo ValarezoPablo Valarezo 

Is there a way to calculate 'number of direct reports' by aggregating manager across accounts?

Given the 'manager' field is populated for all our users, is there a way to calculate which users have X number of direct reports? Or to calculate a 'Team Leader' attribute when they have 5 direct reports or more? Ideally, this would be saved as an attribute in UD and not done via script/API. Thanks!
Adam LoweAdam Lowe (Okta, Inc.)
This functionality is not built into Okta.  You are correct that the API and scripting is one method of performing this, as it would require a custom coded solution.

You can use the documentation linked below:
https://developer.okta.com/docs/api/resources/users

You can use an API call like the one below to pull user information, which will include the manager attribute form their profile:
GET {{url}}/api/v1/users

Once you have pulled this data, you will need to code your own solution to parse the data.  Based on the objective you oulined, it sounds like you'd want to look at the manager attribute for a user, locate the corresponding user in Okta for that manger, then update a custom attribute (Team Leader) that adds the original user as the value for that attribute.  This way, a manager's profile would have a list of individuals that report to them.  (You'll probably want to make that custom attribute a string array for the data type.)

You can then use an API call to POST an update to the manager's profile:
https://developer.okta.com/docs/api/resources/users#update-profile

If you require direct assistance developing this custom solution, you may wish to speak with an Okta account executive about professional services, which is a paid engagement.