Woman looking at map on mobile phone
Help your sales and marketing teams find nearby prospects, assign territories and campaigns, and more! All this is a cinch with Automatic Geocodes for Addresses, available in the Summer ‘16 release. Now you can automatically add geocode information to the pre-existing latitude and longitude fields on accounts, contacts, and leads.

Why do geocodes matter in Salesforce? Unlike addresses alone, geocodes can be used to determine the distance between two points, enabling powerful location-based SOQL queries. Add some custom code to really unleash the power of geocodes. Use them to segment customers and prospects, identify white space, create heat maps, and much more!

Tips and Tricks: Location-Based SOQL Queries and Reporting by Distance

Right out of the box in Salesforce, geocodes can be used to run SOQL distance queries and create reportable custom fields.

Say you want to identify all of your customers within a 50 mile radius of a specific location in San Francisco. You can run a SOQL query using the DISTANCE and GEOLOCATION functions.

To enable users to run reports by distance, create a custom formula field to hold the distance calculation. For instance, you might want to add a field to all accounts indicating how far they are from your corporate headquarters. You can enter the latitude and longitude manually, or use the SOAP API to set values for the global variables $Organization.Latitude and $Organization.Longitude.

While a single formula field works for some use cases, global organizations might need a more flexible solution. One of our Salesforce MVPs figured out that he could use the $User global variable to let any user run reports using their own custom location. Find out how he did it!

More Fun with Geocodes

With custom development, geocodes can unlock a whole new way to understand your customers and run your business. Here are some cool use cases that could be solved using geocodes:

  • Manage and assign territories with precision
  • Show mobile users nearby customers and prospects
  • Plot customers on a map to identify white space
  • Segment customers by location
  • Micro-target leads for events, email campaigns, etc.
  • Track and log mileage
  • Create location-based tasks (“Remind me at a location”)

What will you create using geocodes?


About the Author

Karen Otuteye is a Salesforce product manager working on Data.com. Her team built the Automatic Geocodes for Addresses feature.

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS