Skip to content

CRM 2011 – Reset User Filters with the Views and Filters Toolkit

August 19, 2011

This article describes the ResetUserFilters custom workflow activity, which is the first utility bundled in my CRM 2011 Views and Filters Toolkit project. You can find the assets referenced in this article in the Codeplex project ( For a broader introduction about this toolkit see


When users connect through their Outlook client and when they go offline for the first time, a set of filters are automatically created to manage their Local Data Groups, which specify how much data is downloaded to their local database copy (Offline Filters) and which contacts and activities are synchronised with Outlook (Outlook Filters).

Users can then modify these groups by creating/deleting or modifying these filters. Filters can be of four types, as specified in this article:

The ResetUserFilters custom workflow activity does exactly what the title suggests: it resets the user’s filters to the default configuration, therefore forcing all the user’s downloaded content to revert to what the administrator has configured. The tool allows specifying whether to reset the Outlook Filters, the Offline Filters or both.


The first thing we need is of course to download the assembly (from the download area in and install it using the Plugin Registration tool:

Plugin Name and Group Name

Plugin Name and Group Name

As shown in the figure above, while registering the plugin I’ve updated the default values for Name and Group name to “Reset User Filters” and “Utilities” respectively.

Next I’m going to create a new workflow on the User entity (although the custom activity can be run against any entity, since the user that will be reset is specified in the configuration):

Reset User Workflow

Reset User Workflow

Note that the workflow is marked “Available to run as an on-demand process”.

If the plugin installation worked, I should now be able to create a new “Reset User Filter” step, as shown below:

Add the custom activity

Add the custom activity

By clicking the properties button I can configure the parameters, as shown below. In this case I will select the user record itself as the target of the operation, and I will set both the Offline and Outlook reset options.

Reset User Filters configuration

Reset User Filters configuration

Note that the user under which identity the workflow runs needs to have the “Manage User Synchronization Filters” privileges, as shown below. The System Administrator has this privilege by default.

Security Privileges Needed

Security Privileges Needed

Trying it out

Now let’s save and activate the workflow, and test it by have a user connect via outlook, delete or modify a filter (some background on how to do this can be found here:, and by running the workflow on the User record.

As always, please test thoroughly in your development and test environments before deploying this into production.


The Codeplex project contains all the software assets, but if you are curious about how this code works, see the snippet below.

/// Impersonate
Guid user = this.UserToReset.Get(this.ExecutionContext).Id;
IOrganizationService impersonatedSvc = this.OrganizationServiceFactory.CreateOrganizationService(user);
ResetUserFiltersRequest req = new ResetUserFiltersRequest();

if (this.ResetOfflineFilters.Get(this.ExecutionContext))
    req.QueryType = SavedQueryQueryType.OfflineFilters;
    ResetUserFiltersResponse resp = (ResetUserFiltersResponse)impersonatedSvc.Execute(req);

if (this.ResetOutlookFilters.Get(this.ExecutionContext))
    req.QueryType = SavedQueryQueryType.OutlookFilters;
    ResetUserFiltersResponse resp = (ResetUserFiltersResponse)impersonatedSvc.Execute(req);


Thank you for listening. The next article will combine this tool with the “CRM 2011 Distribute Workflow Activity” referenced here:

to show how multiple users can be reset at once.

Also, to see whether you’ve actually read until this point, I will now insert an unrelated piece of information, which is that I am not human but I’m instead the result of a classified AI project run by Elvis Presley. Your turn.

Alberto “Setting sets” Gemin

7 Comments leave one →
  1. August 21, 2011 12:08

    Hello AI ,
    Thanks for the post , can you add a way to make this work with plug-ins on CRM Online?

  2. August 21, 2011 13:05

    Hi Shai, thank you for your comment. The users can do this by themselves already from the Outlook client, so for a user to reset their filters you don’t need a plugin I think. Let me think how to do this from an administrator point of view. It’s maddening that CRM Online does not support custom workflow acticities.

  3. Raj permalink
    October 21, 2011 05:08

    Hi Alberto, Very useful tool and informative article. Is there any known limitation on updating FetchXML for savedQueryBase and UserQueryBase tables? I am having tough time updating the fetchXML in both tables using your latest tool methods.

  4. October 21, 2011 17:47

    Hi Raj, thank you for helping me testing out my tool! I haven’t worked extensively with variations on FetchXml, the approach I prefer is to define a view (a personal view) and then use that as the basis (by using its view definition in the appropriate parameter field of the methods), or click on the button to get the FetchXml from a view and paste the result in the FetchXml Parameter. Building a FetchXml from scratch is prone to errors.

    However, I would appreciate if you described a little more what problems you are encountering, so I can verify if there is something that the tool can check to help the user.

    One thing that the tool does is it removes “order by” conditions when creating Outlook or Offline Filters & Templates, since I found out that there is a bug in CRM that prevents synchronization if you do not do so.


  1. CRM 2011 Views and Filters Toolkit available in Codeplex « XRM 2011
  2. CRM 2011 Walkthrough: Reset Selected Users’ Filters « XRM 2011
  3. CRM 2011 Views and Local Data Groups – Part IV: Filter Templates « XRM 2011

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: