Disable and enable Dynamics 365 CE users with SSIS & KingswaySoft

Recently I was asked to set up a process to automatically disable or re-enable Dynamics 365 Customer Engagement users depending on some external data. This ended up being ridiculously easy to do with SSIS and KingswaySoft's Dynamics 365 Integration Toolkit. Let me show you how it works.

In Dynamics 365 CE, you can disable or enable a user record just by setting the value of its "isdisabled" attribute to true or false, so both my disable user data flow and re-enable user data flow do roughly the same thing.

  1. Get a list of Dynamics 365 user records to update.
  2. Add a derived column to hold the value to use for updating isdisabled on the user records.
  3. Update the user records.

The disable users package

Here's a screenshot of a sample disable users data flow.
Disable users data flow

Let's take a closer look at each step.

  1. Query users using FetchXML. User query
  2. Add a derived column named "isdisabled" and set its value to 1. Derived column
  3. Update the users. User update

Enabling the users works exactly the same way, except the value of the "isdisabled" column should be 0 instead of 1, so I won't show the screenshots for that package.

Disable user demo

In my Dynamics 365 online instance, I have an active user named "Angus Alexander" who I want to disable. Enabled Dynamics 365 users

When I run the disable users package with the query from above (<condition attribute="firstname" operator="eq" value="angus" />) in Visual Studio, I see success on every step. Visual Studio output

I check back in Dynamics 365 to see Angus Alexander is no longer an enabled user. Enabled Dynamics 365 users

Instead Angus shows up as a disabled user. Disabled users

Now when Angus tries to access Dynamics 365, he sees that his account has been disabled. Account disabled message

comments powered by Disqus