GeoCode Workflow Activity for Dynamics CRM 2011


Finally, I got to complete two new custom workflow activities to GeoCode any CRM entity(OOB or Custom) using BING Maps or Google Maps. I started to look into Nokia Maps and kind of got lost in their HERE site. So lets dive into the details. This is the start of my passion for creating solutions that using mapping to present information to users. This passion started when working at Primedia ( My first exposure to Google Maps. Taking this to the next level by creating solutions that can be used within Dynamics CRM 2011, the ultimate extensible CRM platform.

This post will focus on a CRM power user creating a workflow incorporating these workflow activities. Don’t want to do injustice to the technology that went behind the workflow activities, which is REST service from map providers. Will discuss this aspect in more details in another post. Built this solution using a) Developers toolkit (SDK 5.0.13), Visual Studio 2012, and REST services provided BING Maps and Google Maps. Check Resources section at the bottom the blog, where I provide the links. Additionally, if you download the source from CodePlex, the workflow Activities themselves have the article and links in them.

NOTE: I’ve tested the workflow activities on an on-prem deployment only. Will test crm online and post any updates soon.

Update for CRM Online: Oct. 9th, 2013

I’ve tested the Google Maps custom workflow for CRM Online and workflows is working like a charm. When you register from source code, make sure to select Isolation Model = Sandbox. I’ve removed other errors about Partial Trust issues. Going to provide two solutions, one for Google Maps and one for BING Maps. Check CodePlex for individual solutions.

BING Maps Geocode Activity:

Using BING Maps REST Services Location API some more help from articles published on the MSDN sites, created this workflow activity. In order to get this going, follow instructions to obtain BING Maps Key from Account Center. We will walk through an example of Geocoding an account entity.

  1. Obtain BING Maps key from Bing Maps Account center. Create a new App to Specify the site as http://localhost .

    1. BingMapsKey

  2. Create a workflows that can run as an “On-Demand Process”. You can definitely make this process to run when a) Record is created and b) Record is updated and track the Address1, Address 2. You can Geocode more than one Address, by using the activity in multiple steps.
    2. Activities
  3. Set the Properties that are the input for the Bing Maps activity. a) Bing Maps Key b) Street c) City d) State e) Zip f) Country (ISO Code) . In this I did not spend too much effort in figuring out what makes good address, such as we need at least a ZIP to GeoCode. I will leave this as an exercise you can customize for your needs.
    3. BingMapsProperties
  4. GeoCode activity provides 3 output params a)Lat b) Long and c) GeoCodeResult. One more upgrade that I can do is to provide the quality of the result as an output params that can incorporated into the workflow.
    4. BingMapsOutput_LatLong
  5. Output param GeoCodeResult provided two pieces of info, a)BING Maps Geocode URL and b) first 1750 chars of the XML returned by executing the URL. Little bit about the URL. I use an Unstructured URL, which allows each part of the address to used based on what values are available as part of input params. You can take this URL and navigate in IE, since the output type that I ended up using is XML and view results. Helps with debugging results.
    5. BingMapsOutput_Result
  6. In the example solution provided on CodePlex, you take outputs Lat and Long and update the Account entity and output params Result is used to create a Note.

Next posts will delve into the details of what is happening within the activity when you Geocode an address. Additionally will be updating the CodePlex project with Geocode plugins for Account, Contact and Site. Well if you figure out for one, rest is the same. Will take baby steps. Want to build a SilverLight app that use make use of Bing Maps SilverLight control, make use of SQL 2008 Spatial querying.

Please provide any and all feedback to incorporate into these map utilities. Thanks for your time.

– P


  1. BING Maps account Center:
  2. BING Maps REST API :
  3. Unstructured URL: Get the latitude and longitude coordinates based on a set of address values for any country:
  4. CodePlex – Maps for CRM 2011 :