Recently I had a customer ask how to add Bing Maps to their Salesforce.com solution. I regularly work with developers who are integrating Bing Maps into Microsoft Dynamic CRM, but this was the first request I’ve had for Salesforce.com in a while. In this blog post we are going to see just how easy it is to integrate Bing Maps into a Salesforce.com solution.
It might seem strange to some readers that we are blogging about using Bing Maps on a non-Microsoft platform like Salesforce, but it is a new Microsoft and our services can be used anywhere. In fact Microsoft and Salesforce.com made an announcement earlier this year around joint solutions that they are working on with Windows, Office and Power PI. There is also a good video on the Power BI blog on using Salesforce.com data with Power Query in Excel.
Adding Bing Maps to the Account page
The first step is to go to the Getting Started page of the Salesforce developer site. On this page is a button to get started for free. This will allow you to create a development environment for Salesforce. Once you have done this you can start developing with Salesforce. Currently there is no data in the developer environment, so we will start off by adding an account. To do this click on the Accounts tab at the top of the page, and then press the New button next to the Recent Accounts section.
Screenshot: Salesforce Accounts page
We will create an account for Microsoft UK for testing purposes and will fill in the billing address information as follows:
- Billing Street: 100 Victoria Street
- Billing City: London
- Billing Zip/Postal Code: SW1E 5JL
- Billing Country: UK
When we are done we will press the Save button.
Screenshot: New Salesforce Account Page
This should now take you back to the Accounts page and you should see this newly created account under the Recent Accounts section of the page. If you click on the account name it should open up a page with all the details for that account. We will update this page so that Bing Maps shows up under the billing address information with a pushpin showing the address. To do this, when viewing an account, open the Developer console by clicking the little arrow next to your name at the top of the page.
Screenshot: Link to Developers Console
This will open a new window where you can add some code to be rendered in the page. Press File -> New -> Visualforce Page and call it BingMapsAccount. This will create a new empty page and look something like this:
Screenshot: Developer Console
Be sure to set the map credentials with your Bing Maps key where it says YOUR_BING_MAPS_KEY, otherwise the map will have an error message overlaid on top of it and the search module will be unable to geocode the billing address. Once you have updated the BingMapsAccounts.vfp page with this code, save the file by going to File -> Save. If you now go to the Account page for the Microsoft UK account we created you will notice that the map does not appear. To fix this press the Edit Layout button.
Screenshot: Edit Layout button on Account page
In the panel that appears, select Visualforce page, and drag and drop the BingMapsAccounts page so that it is under the billing address. Press the Save button when you are done. The account page should update and now include a map under the billing address information like this:
Screenshot: Bing Maps showing Billing Address information
We have now integrated Bing Maps into the account page. You can create similar map pages for the contact and lead pages. You will need to change the standard controller and the address fields being referenced. Here is a table with the information available for the Contact and Lead pages.
|Contact Page||Lead Page|
Taking things further
In this blog post we have seen how to add Bing Maps at an account page and how to add a custom field to the accounts page to store the coordinates of the billing address. Bing Maps is easy to integrate into web based technologies such Salesforce.com. Salesforce.com has a lot of similarities to Microsoft Dynamics CRM and a lot of the code samples we have created for Dynamic CRM can be easily migrated to work in Salesforce.com. Here are some blog posts on Bing Maps and Dynamics CRM which may give you some additional ideas of how to use Bing Maps in Salesforce.com.
- Address and Location Capture in Dynamics CRM with Bing Maps
- Geocoding Dynamics CRM Data with Bing Maps
- Create Heat Maps with Bing Maps and Dynamics CRM
– Ricky Brundritt, Bing Maps Program Manager