Finding a Worker’s Manager in Dynamics 365 for Talent Using Flow
Updated: Aug 14, 2019
Microsoft Flow is one of the key tools that we as Talent users can utilise to create more bespoke processes, speed things up and generally make the lives of the day-to-day HR user easier.
One thing that we found that took us an extremely long time to figure out (and something we could not find online ANYWHERE!?) was identifying a Worker’s Manager and extracting their details. It seemed so simple having the Parent Job Position available on the CDS however, this quickly escalated into a rather complex flow. Therefore, we figured that this is something that could benefit a lot of Flow’s and decided to blog about it to save you the time that we spent trying to figure this out. Buckle up, because this is a bit of a long one!
For this example, we are going to use a very basic scenario in order to focus on exactly the entities and actions you need to identify. You can then use this as a base to expand your own scenarios when the situation arises (we may do a 2nd instalment on some outputs to update data in Talent):
A new worker is created in Talent
We want to send an email to their future manager to confirm that they have been set up in Talent and should be able to be seen under their reports.
A bit of an obvious start but if you’re brand new to Flow you’re going to have to set up your connections. To do this, in Flow, click the Hamburger (three lines if you ask us) in the top left corner and then under Data, select Connections.
In this case, we just need the one to the Common Data Service which is where Talent is stored. It is possible to do this with the Dynamics 365 connectors - however, word on the street is that this is getting depreciated so you are best off using the CDS connector (you heard it hear first). Using the CDS connector is something we’ve got into the habit of so far- but its your call. As you can see from the above image, there is an abundance of connectors that get set-up as you play around, which unlock the power of what Flow is capable of.
Creating the Flow
We will map this out in steps for ease of use here.
1. Using the ‘When a record is created’ trigger, set this to ‘Workers’.
2. We need to then retrieve the details of this particular record that has just been created. In this case we are 'getting the worker that has been created' by using the ‘Get record’ action and the 'Worker' dynamic content as the identifier.
3. This is where the process is not as obvious as expected. For ages, we were trying to retrieve the worker’s position by using ‘Get record’ on the Job Position entity and we would continuously get error messages back from this and a failed Flow.
It turns out, that for some entities, the most effective way to find a specific record is to list records and then Filter Query based on the value you are using to identify it. So in this case, you want to ‘List records’ based on the Position Worker Assignments entity and use the Filter Query: _cdm_workerid_value eq ‘Dynamic Worker ID’ (see image below)
Recap: A worker is created in Talent, we then ask flow to get the details of this worker and then ask flow to list the potion worker assignment of the worker.
4. Whenever the ‘List records’ action is used in Flow, the following steps below it will automatically jump into an ‘Apply to each’ box. The next step in this Flow is to get the position that the worker is assigned to - using the information from the Position Worker Assignment entity. Using a ‘Get record’, find the entity ‘Job Positions’ and use the dynamic content of the job position from the previous list records step.
5. We now must work backwards through the step we just completed in order to drill back down to the manager of the worker that was created. Use the ‘Get record’ action to find the Job Position entity and the Parent Job Position from step 4 as the item identifier. This gives us the position which the manager occupies.
6. We’ve got the position but not the worker who that position is assigned to. This stage requires another ‘List records’ action on the Position Worker Assignment. Rather than using the workerid as the Filter Query, this time, as we are working our way backwards through the process, we are going to use the jobpositionid.
Recap: After listing the position worker assignment of the new worker, we then ask flow to get that workers position. Once the position of the worker is found, we can get data regarding the Parent position (also known as reports to position in Talent- AKA Line Manager). In step six, we ask flow to retrieve the worker assigned to the parent position.
7. As before, this has given us another Apply to each box. The final stage to getting the manager record is a simple ‘Get record’ for the Workers entity based on the Worker GUID Dynamic content that was surfaced from the previous step.
8. Congratulations, you now have all the information surfaced from the database using Flow to correctly identify a worker’s manager.
9. Finally, to finish off this scenario, use the ‘Send an email’ action from Outlook. Populate this with the dynamic content that we’ve surfaced from these previous steps, including the Managers email address to send to, to suit your needs.
10. Your final flow should look like this (We have renamed some of the steps to help you all out - thank us later):
Hopefully those 10 steps can make your lives so much easier for all the weird and wonderful combinations of Flow’s and PowerApp’s that may need to identify a worker’s manager and get their details. Comment or contact us with any other tips you have regarding these kinds of Flow’s in Talent as we are sure people out there will have built some clever flows for Talent.