A Microsoft Dynamics CRM 4.0 user asked recently how to tag or categorize his CRM Contacts. He wanted to have a list of tags such as golf, baseball, accounting, etc with which he could easily tag users and organize them based on category. The categories will also be useful as classifications to use in building marketing lists.
This is pretty easy to do using basic Microsoft CRM customization.
1. Create a custom entity called “Category.” I set it as Organization owned, as no one will be owning a particular category. Set the display area to “Settings.” The form will contain just the name field—this is ok, that’s all we need. Click Save and Close.
2. Create another custom entity called “Contact Category. Again, select Organization ownership rather than user owned. Click the Primary Attribute tab, and set the primary attribute requirement level to “No Constraint.” Click Save (not save and close).
3. From the Contact Category entity customization, click N:1 Relationships. Select Contact as the Primary Entity. Under Relationship Attribute enter “Contact” as the Display Name. Under Navigation Pane Item for Primary Entity select “Use Custom Label” for Display Option and enter “Categories” as the Custom Label. We do this because we want the navigation bar link from a contact record to say “Categories.” Save and Close.
4. From the Contact Category entity customization, click N:1 Relationships. Under Relationship Attribute enter “Category” as the Display Name. Under Navigation Pane Item for Primary Entity select “Use Custom Label” for Display Option and enter “Contacts” as the Custom Label. We do this because we want the navigation bar link from a Catogory record to say “Contacts.” Save and Close.
5. From the Contact Category entity customization, click Forms and Views and double click on the form customization link. Remove the Name field from the form and add the Contact and Category fields created by the newly added relationships. You will also want to be sure to modify the Contact Category associated view to display the contact and category fields. Click Save and Close.
6. Publish the Contact, Category, and Contact Category entities. Refresh your browser.
7. In Microsoft CRM, click Settings and select the “Categories” entity from the navigation bar. By default it will appear on the bottom of the list. You can change its position in the list—see Organizing Settings Navigation Bar for more details. Add categories to the list by creating new Category records. Use the Save and New button to efficiently add multiple categories.
8. Now you will be able to easily tag your contacts. From a Contact record, click the side navigation bar link for Categories and add a category to the contact.
9. So say that John Smith has a new interest, Vegetable Gardening, which is not part of the list? CRM 4.0 makes it easy to add values on the fly. When you click “New Contact Category” from the John Smith record, when you click the lookup for Category, click the “New” button on the lookup form and define your new category. This will add the category to the list and add the category to the John Smith record.
10. So now that we have tagged our contacts, how do we find the contacts are tagged “Fishing?”
We can navigate to Settings—> Categories and open the record for the desired category. By clicking the side navigation link for contacts, you will see a list of all contacts that are tagged with “Fishing.”
You could also do an advanced find to get all contacts where related category entity Category equals “Fishing.”

Microsoft CRM Customizations is really amazing. thanks for sharing that.
Posted by: Andrue Bingo Night Live | July 08, 2009 at 01:39 AM
Any reason why N:N is not used? Sounds like a case made for it.
Posted by: George Doubinski | July 08, 2009 at 07:28 PM
Hi George,
Thanks for reading and commenting!
You have a great point--you could use a N:N relationship. It really is a matter of preference.
Given the scenario that I laid out, a N:N relationship between contacts and categories would work; however, I would say that it would depend on what else you wanted to do. If you only want to have a tag, N:N will work, and the benefit is you can more quickly add multiple categories to a contact; however, if say you wanted to down the road expand the classification to have additional attributes, say a description of the relationship between the category and the contact, or add a subcategory field, N:N is limited to only the two attributes in the relationship. Also, an N:N relationship does not allow you to trigger workflow or create relationship records via workflow--so if you wanted a workflow to trigger a system event when someone is tagged with a specific category, or if you wanted to create a workflow to tag someone with a category when they purchased a specific product, for example, and N:N relationship would not work.
Granted, this is outside of the scope of the scenario that I described. I guess I have painted myself into a corner a couple of times with an N:N relationship that I did not think would require additional relationship attributes or workflow, only to find later on that was needed, so I lean toward this approach to give the maximum degree of flexibilty in functionality.
Posted by: Joel Lindstrom | July 08, 2009 at 10:13 PM
Hi,
Good example. And it's dynamic.
Usually I have used Marketing Lists for the same purpose, because then you can do multi update on a contact list from the contact search list.
Morten
Posted by: Morten Dybdahl | July 12, 2009 at 09:06 AM
I recently use a JScript customization to be more flexible without have a need to maintain my categories.
Take a look at http://taggingfield.codeplex.com/
Mark
Posted by: Mark | August 11, 2009 at 04:51 PM
Mark,
Great work---looks nice. I will try it out.
Posted by: Joel Lindstrom | August 11, 2009 at 05:32 PM
Mark,
Wonderful and simple way to do this.
It doesnt seem to look exactly the same when I do it live however. I don't get the persons name when I look at the category and vice versa.
It stays blank.
Posted by: David | October 22, 2009 at 12:37 AM
hey guys! thanks for your feedback. :)
@david - i have no clue what the problem can be. on my installation the script works pretty neat. maybe you should try to start a new thread on the codeplex project page. there is already a "how to start"-post that was answered by the project coordinator...
http://taggingfield.codeplex.com/Thread/View.aspx?ThreadId=58111
Posted by: Mark | November 05, 2009 at 05:47 PM