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.
- Get a list of Dynamics 365 user records to update.
- Add a derived column to hold the value to use for updating isdisabled on the user records.
- Update the user records.
The disable users package
Here's a screenshot of a sample disable users data flow.
Let's take a closer look at each step.
- Query users using FetchXML.
- Add a derived column named "isdisabled" and set its value to 1.
- Update the users.
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.
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.
I check back in Dynamics 365 to see Angus Alexander is no longer an enabled user.
Instead Angus shows up as a disabled user.
Now when Angus tries to access Dynamics 365, he sees that his account has been disabled.