Country lists and multi-language lookup fields

5 comments

Posted on 1st October 2012 by Jukka Niiranen in Configuration |Tips

, , , , ,

One of the most common customizations almost any organization working with customers from multiple countries will want to have in their Microsoft Dynamics CRM data model is the addition of a structured list of country names, to ensure they are stored in a consistent format. Yes, by default the Country/Region fields on the account, contact and lead entities are free text fields that a user must manually fill every time. This can result in some serious issues with data quality that make it difficult to perform a common task such as searching for accounts from specific countries. The field may contain values like “United States of America”, “United States”, “USA”, “Estados Unidos de América”, not to mention different conventions for upper/lowercase letters, hyphens etc.

Why doesn’t Dynamics CRM come with a pre-configured list of countries? There are probably several reasons for the choice of this design, some of them which date back to the early days when CRM wasn’t a multi-language platform (before version 4.0 came along). Anyway, there’s absolutely nothing stopping us from fixing this gap by using the basic customization tools, so let’s get right to it!

Picking the right Country field option

There are two alternative approaches to implementing a controlled list of values for country names. You can either create a new option set (preferably a global one) or a new entity to hold the country name values. There are pros and cons to each method, which means the right choice depends on the use cases of the organization in question. In a simple scenario the option set may well be sufficient, if there are no other requirements for country data in CRM. For implementation guidance, look no further than this excellent post by Pedro Innecco: Dynamics CRM: Adding a Country/Region option set using ISO 3166-1.

Sometimes the country data management requirements may be somewhat more complex, which may lead you into choosing to create a custom Country entity. This approach has the benefit of allowing you to store other variables than just the name of the country on the same record. For example, there may be parameters related to reporting that are country specific and would therefore be logically placed on the same record as the official name of the country. Other regional variables such as states or languages spoken are also a natural fit to be stored on the country entity.

One interesting scenario to explore is the possibility of using the Country records as a central location for posting updates specific to a particular region, by using Activity Feeds on the Country record’s wall. Let’s say you have a multi-region Dynamics CRM implementation and you want to target auto-posts to users working with customers from specific countries. By generating posts like “New campaign Big Fair 2012 launched in @Finland” or “Major opportunity closed in @Sweden for account Contoso” that mention the country record you can easily push updates to any user who’s following that particular country. For a more detailed explanation please see my earlier post on how to make CRM Activity Feeds easier to follow by creating custom groups.

There’s a catch with the custom entity approach, though, and that is the lack of native support for multiple languages. While the option set labels are a part of Dynamics CRM solution files and support translations just like your regular form fields, a custom entity is just data stored into the CRM database, no matter if you use it in a metadata like manner. As a result, if your CRM organization has different languages enabled and the user switches from English to Spanish, the value on the Country field on the account form won’t change from “United States of America” to ”Estados Unidos de América”. If you had used an option set, all you’d need to do is export the labels for translation, enter values for the Spanish language column for the option set values, import it back and publish the results. However, with the custom Country entity we’ve ended up choosing, the value stored in the name field of the Country record will display the same way, regardless of the UI language of the logged in user.

Nothing a little Jscript can’t fix

Lucky for us, Pedro has come up with a solution that can also handle the multi-language support requirement when using a custom entity to hold the country labels. In the image below, you can see an account record viewed first in English, then in Finnish. Even though we’re using a lookup field to the Country entity on the account form, the label of the selected Country record has magically been translated from one language to another. As if that wasn’t enough, also the Look Up Record dialog window shows a list of values that has been tailored to the language of the user. Well, that looks like the best of both worlds, doesn’t it?

How can you switch the label in the lookup field then? All you need to do is to download the Country/Region for Dynamics CRM solution created by Pedro Innecco and configure your CRM organization to take advantage of the scripts included. The solution also provides the ability to add more languages, so I’ll list out the steps I followed to add the Finnish language support for this Country lookup field.

(more…)

Did you just disable duplicate detection in CRM by accident?

1 comment

Posted on 3rd April 2012 by Jukka Niiranen in Annoyances |Tips

, , , , ,

Duplicate detection rules in Dynamics CRM are an example of a configuration item that may often be active only in production environments. Since you don’t actively enter data into development or test environments, why bother thinking too much about them? Well, the one place where you need to be thinking about them is when you are importing new solutions and publishing changes to customizations.

Life would be easy if you could just set up and publish your duplicate detection rules once during the initial configuration of your Dynamics CRM production environment, thus stopping the unintentional entry of duplicate records into the customer database. However, you may run into a situation where a rule that you’ve once published has later on returned to an unpublished state. “What? Who touched my duplicate detection settings?”

The likely answer to the question is “You did, but unintentionally”. You see, the duplicate detection rules are sensitive to changes in your entity customizations. As noted in the Madrona Solutions Group blog article, whenever any entity metadata is changed, all duplicate detection rules associated with that entity are unpublished.

If you look at this from the system’s perspective, the process does make sense. After all, you might have set up a duplicate detection rule that is comparing records based on a criteria that that references fields you’ve changed or removed as a part of your CRM customization actions. Still, the fact that a publish event on a CRM 2011 solution triggers an unpublish event somewhere else is not very intuitive and most system administrators are likely to be unaware of the impact. As a result, there are certainly several production CRM environments out there where the once carefully planned duplicate detection rules have been deactivated because of this dependency between solutions and duplicate detection. In fact, you might want to check your own Dynamics CRM environment right now and check if you see duplicate detection rules with the status reason “unpublished” which should in fact be published.

What this means in practice is that anyone who’s deploying solution updates to an environment that is using duplicate detection rules needs to instructed to always re-enable the rules after they’ve updated customizations that reference an entity which is being monitored for duplicates. In my opinion, it would be very practical to have the system notify you about this task, for example by asking “would you like to re-publish the affected duplicate detection rules?” when publishing a solution. If you would like to see this functionality changed in a future version of Dynamics CRM, please sign in to Microsoft Connect with your Windows Live ID and vote for the item “Automatically re-publish duplicate detection rules after deploying a solution”. Thanks for your contribution.

 

Edit 2013-05-02: There’s a post on Magnetism blog that shows you how to write a plugin that will automatically publish unpublished duplication detection rules after the “publish all customizations” event, in case you want to automate this procedure in your production environment.

Connections don’t merge, so be careful with duplicate records

5 comments

Posted on 12th November 2011 by Jukka Niiranen in Annoyances |Features

, , ,

Update 22.3.2012: this has now been fixed in Update Rollup 7 for Microsoft Dynamics CRM 2011 (KB 2600643). Go and get the file here, unless you’re using CRM Online.

Connections are a nice new feature in Dynamics CRM 2011 that allow you to create ad-hoc relationships between two records of almost any entity type. Additionally, you can specify roles for both the Connected To and Connected From parties, to describe the connection in more detail, as well as provide start and end dates for the connection. These are very handy for recording non-hierarchical relationships between contacts and accounts that tend to exist in the real world. As an example, a person working as the CEO of Company A might be a member of the board in Company B, which means they should be visible under both accounts. Company A would then be the parent account of the contact, whereas there would be a connection between the contact and Company B.

Another common real life phenomena is that duplicate records find their way into the CRM database. This can be due to data imports from external databases, web forms feeding in new contacts, or simply two users being unaware of each other’s records and entering data with slightly different spelling or email address variations. Luckily Dynamics CRM has a built-in functionality that allows you to merge duplicates from the database. This process will move all the child records from the subordinate record to the master record, thus ensuring that everything remains linked to the active record and not the deactivated duplicate.

Except that for connections this doesn’t happen! Once the merge is done, all the connections will still be referencing the inactive record, not the master record. In the aforementioned example, you would have effectively lost the information about the contact’s relationship with Company B. Even though you could still see it by opening up Company B’s record and seeing the connection there, how would you ever have known where to look?

There is an existing feedback item 683301 on Microsoft Connect regarding this functionality:

Here’s a quote of the comment I’ve posted on the item:

I think this is a serious flaw that undermines the perceived reliability of the Merge Duplicates feature in the eyes of the end users. The merge screen indicates that all child records related to the subordinate record to be deactivated would be transferred to the master record, but it doesn’t warn that connections would need to be manually checked.

The merge process works just fine for custom entities, activities and pretty much everything except connections. Why would the user ever want to leave behind some non-duplicate information to the deactivated record? By merging two accounts or contacts the user is effectively declaring that these represent the same object in the real world. If something in the database has a relationship with either of these records, it should be carried over to the active record, as the inactive record no longer serves any other purpose than indicating the prior existence of a duplicate entry and the possible differences in attribute values compared to the current active record.

If you think connections should be transferred over to the master record when merging duplicates, be sure to log in to Microsoft Connect with your Windows Live ID and cast your vote on this item. In the meantime, if you’re planning to use the connections entity for recording any data related to accounts, contacts, or leads, my suggested options are:

  • Don’t do it. Create a new custom entity for recording this data, as they will merge over to the master record just fine.
  • Develop you own plugin for capturing any merge events and updating the related connection records accordingly.
While we’re on the topic, I also tested what happens to the old Relationship records that were used for connecting account, contact and opportunity records in versions prior to CRM 2011 (and are still visible in an upgraded organization). The result? When merging two contacts, any relationships referencing the subordinate record are deleted! Yeah, crazy, I know. If you’ve got any insight on what is the reason behind this perplexing system behavior for either connections or relationships when dealing with duplicate records merging, please leave a comment in the box below.

Switch to our mobile site