Skip to content

CRM 2011 Views and Local Data Groups – Part III: Deploying System Filters

September 28, 2011

Continuing the series of articles related to the CRM 2011 Views and Filters Toolkit, this article shows how to deploy system-wide filters for Outlook users. You can find more information about the toolkit by selecting the Views Toolkit Category of this blog. For a detailed discussion about Filters and Templates see this article.

Note

This note applies to this article as well.

Introduction

By default, CRM synchronises My Contacts to Outlook. Users can create additional filters to expand the range of contacts that they synchronise, but it is possible to do this across the board (i.e. for all users), and the quickest way to accomplish this is by creating a System Filter.

Outlook Contacts View

Let’s start by logging in as the CRM Administrator and by creating a personal view called Outlook Contacts; this view shows all active contacts that a user has interacted with (i.e. for whom there are related activities that are also related to them).

See the picture below for the filter conditions:

Outlook Contacts View

Outlook Contacts View

Make sure you save the view and remember its name because we’ll use it later.

Deploy System Outlook Filter Workflow

Next we’ll create a workflow based on User, called Deploy System Outlook Filter, as shown in the figure below:

Deploy System Outlook Filter workflow

Deploy System Outlook Filter workflow

Note that the workflow could run on any entity; it is just for convenience that I’ve chosen the User entity.

The workflow is composed of three steps:

Retrieve view

This step uses the RetrieveView custom activity to retrieve the Outlook Contacts personal view definition. I’ve specified the following parameters:

RetrieveView Parameters

RetrieveView Parameters

The activity will search for a personal view named Outlook Contacts owned by the user the workflow is running on (which will then have to be the CRM Administrator), and of type 0 (zero). Type 0 (zero) corresponds to type MainApplicationView, as referenced here. Note that I could have entered MainApplicationView instead than 0, the code interprets both names and numeric values when specifying a type.

Check if found

The RetrieveView custom activity has a return parameter called Count of Views which tells how many views were found. Before proceeding I should make sure that one view (and one only) was found:

Check return value of RetrieveView

Check return value of RetrieveView

Deploy Filter

This last step uses the DeploySystemView custom activity with the following parameters:

Deploy Filter parameters

Deploy Filter parameters

I’ve set four parameters, which are:

  • When Existing: Update – This means that if the destination view already exists, the activity will overwrite it. See the documentation in Codeplex for other possible values of this parameter.
  • System View Query Type: OutlookFilters – This is the type of the view when deployed. Since I want to deploy a system filter for outlook synchronization, this must be either OutlookFilters or 256. For a list of all view types see here.
  • System View Name: Outlook Contacts (System Filter) – This overrides the name of the view when deployed. If left blank, this would be the same name of the view in the View Definition parameter, which in this case is Outlook Contacts.
  • View Definition: View Definition(Retrieve View) – This is the actual definition of the view, which is set to the output parameter of the RetrieveView activity.

Test

Now select the record relative to the user that owns the Outlook Contacts personal view (in this example the CRM Administrator), and run the Deploy System Outlook Filter Workflow.

If the workflow completed successfully, users will see the following screen when looking at the synchronisation settings from within their CRM Outlook Client:

Outlook Filters

Outlook Filters

This means that in addition to their custom rules for synchronisation of contacts, which include by default My Contacts, all users will synchronise contacts that are returned by the query we’ve just deployed.

Conclusions

This was a walk-through of how to deploy a system filter without coding, and with the help of the CRM 2011 Views and Filters Toolkit. Note that this example can be also applied to System Offline Filters. The only change needed is to specify OfflineFilters query type instead than OutlookFilters in the DeploySystemView activity.

Alberto “Contact the Filter” Gemin

Advertisements
8 Comments leave one →
  1. October 25, 2011 10:40

    Any chance you can give us a guide on how to create and configure the 2 custom activities RetrieveView and DeploySystemVView

  2. October 25, 2011 14:23

    Hi Francis, have you looked in the documentation pages in Codeplex? Let me know if the explanations are not clear, and thank you for trying out the toolset.

  3. November 30, 2011 19:48

    Alberto –
    When I try to build the plugin – I’m seeing your namespace listed in the menu- not the nice names you created “AG Utilities:Retrieve View” – so in my evironment it looks like repeated listings of “Gemina.CRM2011.WF.LdgManage” and it cuts off – it’s only when you hover over the item do you see the full name “Gemina.CRM2011.WF.LdgManager.AdDeployUserView” in the pop-up/flyover text –
    Is that something I can / should configure differently about the way I registered the plugin?
    Thanks – Scott

  4. December 1, 2011 13:24

    Hi Scott, are you referring to the name and group name of the plugin? If so the new Plugin Registration Tool takes the long name as the default unfortunately. So what you need to do after you’ve registered the plugin is, using the plugin tool, modifying the name and group name (which you can do using the properties window) and save. Or, you can use the trick that I describe here: https://xrm2011.wordpress.com/2011/08/23/crm-2011-%E2%80%93-default-name-and-groupname-for-your-custom-activities :)

    HTH

  5. December 2, 2011 22:16

    Thank you Alberto – That worked perfectly – and as the kids say, “Awesomesauce!”

  6. Mark Weilandt permalink
    May 15, 2012 14:39

    Hello Alberto. I am trying to import the solution to a CRM 2011 Online instance and the plugin fails to import. The log file does not provide any information. Do you have any suggestions? Has this tool been used with CRM Online? Thanks for your help.
    Mark

  7. Péter Czeller permalink
    November 2, 2012 13:31

    Hi Alberto,

    The tool is perfect thank you very much for it.
    I would have a question about functions to the user and system filters.
    Let’s say a dummy example: a company would like the followings:

    – Their users should only see Accounts where the name begins with A. Therefore they deploy a system offline filter.
    – One of the user creats a User offline filter where he sets all the Accounts where the name begins with B.

    The question is: will he only see the Accounts which begins with A, because the System filter has priority? Or will he see the Accounts with B as well?

    In addition. Is that possible that there will be a conflict with System and User Filter?
    What if System Filter says: All active accounts only with B
    User filter says: All active accounts

    Thank you for your answer in advance!
    Peter

  8. February 21, 2013 11:36

    Thank you so much for taking some time to compose “CRM 2011 Views and Local
    Data Groups – Part III: Deploying System Filters XRM
    2011”. Thanks again -Meridith

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: