Geocoding Salesforce Records Natively
Why would you want to geocode accounts?
Geocoding has many benefits. Salesforce supports geocoded fields and also search of those fields enabling you to perform searches like show me all accounts within 5 km of this location etc. This can be quite powerful for a number of applications. I’m working on a project where I wanted to map (partner) account locations on a map and publish that map to a public (communities) website. So I did some renewed digging into this feature.
Historically one would have used third party services such as the google maps api to populate these fields : https://developers.google.com/maps/documentation/geocoding/intro
However this isn’t ideal, you need to manage keys and be aware of usage limits that may impact your application.
In the Summer’16 release Salesforce made a data.com feature to geocode these fields generally available. How do we set that up ?
Automatically Geocode Your Records
First you will want to go to Data Integration Rules in Setup



Activate the rule(s) you want to update for example in my case I want to ensure that the billing account geolocation data (BillingLatitude, BillingLongtitude) is populated.
Side Note :
Account BillingAddress, ShippingAddress etc are compound fields so while the location information will be accessible through the API and in any search queries or Apex you want to run its not easily visible in the standard UI so particularly for testing purposes you might want to create custom formula fields that expose these parts of the compound address field.
Also you need to create custom formula fields to expose the BillingLatitude and BillingLongtitude information on the Account Layout.
See H&T article linked below for further details. The steps are as follows for the custom formula field:
- Data Type: “Formula”
- Formula Return Data Type: “Number” (with 4 decimal places)
Enter the formula.
- Use the Advanced Formula tab
- Click “Insert Field,” and enter the “Latitude” field
Add the field to your page layouts.

You can also add the Data Integration Rules related list to the object page to check the status of these Data Integration Jobs


Adding Geocode Fields To The Account Layout
