CRM 2011 Walkthrough: Reset Selected Users’ Filters
This article describes how to combine the ResetUserFilters tool with the Distribute Workflow Activity tool in order to run the ResetUserFilters task for multiple users. The example shows how to reset views of all users belonging to one business unit, but the method is the same for any other relationship.
You need to have the Distribute Workflow Activity and the Views and Filters Toolkit plugins downloaded and registered.
For an introduction about these tools see CRM 2011 Distribute Workflow Activity available in Codeplex and CRM 2011 – Reset User Filters with the Views and Filters Toolkit. You can find the assets referenced in this article in the Codeplex projects (http://crm2011ldgmanager.codeplex.com/ and http://crm2011distributewf.codeplex.com).
We need to create two workflows, a parent (that runs on Business Unit) and a child (that runs on every User affected). Let’s start by creating the child: a workflow on User that resets the user’s views through the ResetUserFilters utility. I named it Reset User Filters:
The workflow runs the ResetUserFilters activity for enabled users. Note that one could also specify additional criteria, depending on business rules. Note also that the workflow is marked “Run as a child process”.
Next we need to determine the name of the relationship between Business Unit and User. Looking at the picture below (showing the Business Unit entity), we see that the relationship’s name is “business_unit_system_users”.
Next I’m going to create the parent workflow on the Business Unit entity which uses the Distribute Activity workflow one-to-many step to launch the Reset User Filters workflow for all users that have this relationship with the business unit. I named it Reset BU’s Users’ Filter.
See the figure below for the step parameters:
Now that the workflows are created and activated, let’s test by invoking the Reset BU’s Users’ Filter for a business unit (or for the whole organisation).
Note that the distribution has been applied to four users that belong to the base organisation, but only two are legitimate. SYSTEM and INTEGRATION are default users that have the Enabled flag unset, so the child workflow will have filtered them out. However, to my knowledge, nothing happens if you run the ResetUserFilters for those users too.
Stay tuned for additions to the toolkit. The goal is to provide a complete set of tools for the System Administrator to manage users’ views.
You can find more information on how to use the toolkit by clicking on the Views Toolkit category of the blog.
Alberto “Evil Administrator” Gemin