Tip #1105: Replacing the standard country text field

Country fields in D365 are text fields. The reason they are text fields is that that’s how it works in Outlook, and since addresses for contacts in OUtlook synchronize with D365, they are text fields in D365.

Many companies that use CRM have replaced the country and state fields with option sets or lookup fields; however, there are some considerations:

  1. Outlook synchronization: keep in mind that contacts tracked in Outlook will create contacts in D365, and contacts updated in D365 will synchronize to Outlook, if you remove the text field and replace it with an option set, contacts synchronizing with Outlook won’t show the country, and contacts tracked in Outlook will update the text field, resulting in a country not being displayed on the contact form in D365.
  2. More addresses: Addresses in D365 don’t actually live on the account or contact. They live in the customer address entity, which is called “more addresses” in the record navigation bar. Just because you add a custom country option field to the contact form won’t make the same option set field be populated in the customer address record.

Probably the easiest solution is to add the country option set and have a process update the standard text field with the value selected. This gives you a standard list but ensures that the standard country field is populated so it is populated in the address table as well as the contacts synchronized to Outlook. This doesn’t give a complete answer for contacts tracked from Outlook—the country option set would still be blank for these contacts, but you could create a cleanup batch job that updates these contacts that don’t have a country selected in the country option set.

2 thoughts on “Tip #1105: Replacing the standard country text field

  1. Stuart Fawcett says:

    It would be useful to have a way of using global option sets to match country codes to country descriptions, e.g. UK – United Kingdom etc.
    Also language variations of this.

    Then the user can select either the country code or the country.
    Might this be called an option set array?
    Data example
    8400000001, UK, United Kingdom

    • Craig H says:

      We standardized the Country and State fields by extending the Auto-Complete JS functionality as seen in the sample from Microsoft here:

      https://msdn.microsoft.com/en-us/library/mt607648.aspx

      We added some validation checks to ensure the user can only select values from the list we provide and if a user types in the label (United States) or the ISO code (US) for a country, the script will always insert the ISO code into the field. Same applies for the state/province field. This method still uses the OOTB text fields but enforces data integrity.

Leave a Reply

Your email address will not be published. Required fields are marked *