Some employee data from the HR system is synced to our local AD, like department and manager. The local AD is synced to Azure AD and when a user is “added to” (enabled in) Dynamics 365, only some of the attributes are copied from and stay in sync with Azure AD.
Department is not a standard attribute of the User entity in Dynamics 365, so I’ve added a custom field (SLoT) for that purpose. Normally I would add the department manually after a new user is enabled in Dynamics 365, but I would like to keep it in sync with the HR system because of the changes. Here comes Flow to the rescue. This is the overview of the flow:
We can use a Recurrence as trigger to get all active users from a Dynamics 365 organization.
Then for each user we get the user record details and get it’s Office 365 user profile.
Then we compare both values and if they are not equal we update the user record with the new value for department.
And that’s all.
With the Recurrence we can schedule the sync for an interval and frequency of choice.