User attribute values lost in synchronization > Flow to the rescue: Manager

Posted by

The Organization hierarchy in Office 365 is based on the Manager attribute of users, and can be shown in Delve for example. But the Manager attribute is not synced to Dynamics 365 when users are enabled.

We can get the manager of a user by calling the Get manager (V2) action of the Office 365 Users connector in Flow. Since the Manager field of the User entity in Dynamics 365 is a lookup (to the User entity) we need to get the userid of the manager.

There’s an update version of the flow, see: 

Here is the overview of the flow:


First we get all active users and for each user we get their details and get their manager.

We check if the manager is not empty, and get the user record filtered on the user name of the manager.

Then we get the details of the manager’s user record, if available (I didn’t build in this check yet).

Finally we update the user record with the userid of the manager in case they’re not equal.

And here are the (test) results in Dynamics 365:

The Organization hierarchy is now available in Dynamics 365 as well.

Disclaimer: when the manager is not part of the business unit hierarchy then the flow will presumably fail, so be sure to administer the business unit hierarchy in Dynamics 365 in case of organizational changes that have impact on the security structure.

8 comments

  1. Hello,

    I’m assuming this will fail if the manager is not also a user in Dynamics 365… please correct me if I’m wrong.

    thanks!

    1. Hi Kaitlin,
      Yes, if there’s no user found with the userprincipalename of the manager, the flow will stop because there’s no “each to apply” to.

  2. is this solution still valid ?
    we dont’ observe user related flows for Dynamics.
    Dynamics is showing deprecated

Leave a Reply

Your email address will not be published. Required fields are marked *