Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Unanswered

OData query get Worker their position and their manager in one query

(0) ShareShare
ReportReport
Posted on by 75

Hi,

I'm trying to get worker information, their position and their manager however I'm having difficulties in getting the manager data in the same query and wonder if there is good way in achieving it in one single query?

As of now I have 2 queries where I can merge the information in the background but would like to achieve it in 1 query. Here us what I have so far:

Get worker and their position (simplified where I have removed the select statement): 

/data/Workers?$expand=EmployeesV2,ContractorsV2,PositionsV2&$filter=ObjectId ne 00000000-0000-0000-0000-000000000000 and WorkerStatus ne Microsoft.Dynamics.DataEntities.HcmWorkerStatus'Terminated'

Get workers and their manager:

/data/EssWorkerManagerRelations?$expand=Manager($select=AadUserPrincipalName,AadUserObjectId,Name),Worker($select=AadUserPrincipalName,AadUserObjectId,Name)

Thanks in advance.

  • Adam A Profile Picture
    Adam A 75 on at
    RE: OData query get Worker their position and their manager in one query

    Ended up in using 2 queries and handle data management in the background. Don't seem to be a way solving this.

  • huijij Profile Picture
    huijij 19,811 on at
    RE: OData query get Worker their position and their manager in one query

    Hi Adam,

    The OData.org reference services contain a few clear examples of expand URI syntax.

    www.odata.org/.../

    If you want to merge queries, you have to make sure that the entities are related.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,162 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans