Geolocation and its Utility in Salesforce
Geolocation is a very handy field type in Salesforce that can be leveraged to specify the location of any objects such as Accounts, Contacts, Leads and any custom objects that represent physical locations such as Warehouses, Factories, stores and more.
Geolocation in principle is a compound field that comprises ‘Latitude’, ‘Longitude’ and counts towards Org limits as three fields where one is used for internal use.
Geolocation Fields are generally available in both Salesforce Classic and Lightning Experience and are available in all editions including Salesforce1.
Admins can use the Geolocation custom field type to create location fields on any objects in Salesforce.
Populating data in Geolocation Fields:
With Summer 16 release, auto-populating geocodes for addresses on Accounts, Contacts and Leads are made possible in Salesforce through geocode clean rules.
Latitude and Longitude data can also be populated in Salesforce through data import tools such as wizards and Data Loader.
Developers can also leverage SOQL, APIs, Workbench or any Geo-Coding service to auto-populate Latitude and Longitude information on records based on their address information.
Geolocation fields are a perfect fit when implementing solutions to use cases such as
- Calculating the Distance to the customer or prospect location from the Company Warehouse to decide on the transport costs
- Plotting the customer or prospect locations on maps in order to decide the travel route of the Field Techs
- Tracking the travel path of Sales Reps or Service staff real time (implemented in App-exchange apps such as Tablet-20)
- Defining case resolution time or SLAs based on Client location and availability of workforce in the locality.
Considerations & Limitations:
Being a compound field, Geolocation field cannot be used directly in the below mentioned areas. We need to use the individual field components instead.
- Data updates, import and export
- Bulk Queries
Some of the other limitations include:
- Salesforce can automatically populate or update Geolocation information on Accounts, Contacts, Leads and Work orders only (through geocode clean rules). For all the other objects we have to use a geocoding service or APIs or SOQL.
- They are not available in Schema Builder, Dashboards and they are not supported in custom settings
- They can’t be used in Workflow Updates and Approvals if they are filter based. They can be used in formula based Workflow updates and Approvals though.
- Geolocation fields and Latitude and Longitude of the Standard Addresses are not supported in Salesforce to Salesforce
- While using the Geolocation function in SOQL queries, the Geolocation field should always precede latitude and longitude coordinates. For example, DISTANCE (store_location__c, GEOLOCATION (22.345,-98.624), ‘km’) is correct while DISTANCE (GEOLOCATION (22.345,- 98.624), store_location__c, ‘km’) isn’t.