
Add Geocodes for Addresses Automatically in Salesforce
Salesforce provides us this advance feature to make addresses more accurate and reliable. Basically, to transform a postal address description to a location on the Earth's surface, the computational process of this is called Geocoding. Geocode information searches a location using latitude, longitude, and accuracy rating. Geocode locations are much useful in many cartography, GIS analysis, decision making workflow, transaction mash-up or injected into smaller and larger business processes.
In Salesforce, Geocode fields are available for addresses on accounts, contacts and leads. Geocodes can unlock a whole new way to understand our customers and run our business.
This special feature is available in Enterprise, Professional, Unlimited, Performance and Developer Editions in Salesforce Classic only.
Accuracy tells us more about the location of latitude and longitude. For example, An Address accuracy rating means that the longitude & latitude represent a point that’s in the same building as the address on the record.
So, to view Geocodes for addresses, we must define these geocode fields (mandatory). In just few steps, we can set up geocodes in an org. By the help of these images it is quite easy to understand how really it works. So, I am showing an example for Account object.
Steps to Set Up Geocodes in a Salesforce Org:
- Create a custom field for Accounts called "Shipping_Latitude"Data Type: "Formula"Formula Return Data Type: "Number" with 4 decimal places
- Enter the formula in the Advanced Formula tabClick "Insert Field" and enter the "ShippingLatitude" field
- Add the field to object’s page layouts
- Create a custom field for Accounts called "Shipping_Longitude"Data Type: "Formula"Formula Return Data Type: "Number" with 4 decimal places
- Enter the formula in the Advanced Formula tabClick "Insert Field" and enter the "ShippingLongitude" field
- Add the field to object’s page layouts
- Create a custom field for Accounts called "Shipping_Accuracy"Data Type: "Formula"Formula Return Data Type: "Text"
- Enter the formula in the Advanced Formula tabData Type: "Text"Insert the "ShippingGeocodeAccuracy" field in the parentheses ()
- Add the field to object’s page layouts
Now the geocode information is associated with an Address and is visible on account records. Repeat the same steps to add the discussed geocode information to page layouts for contacts and leads.
Now we have to set up geocode clean rules which is available in Salesforce Classic only.
Steps to set up geocode clean rules:
- Login to the Salesforce org.
- Click on the Setup option upside right hand side.
- From Setup, enter Clean Rules in the Quick Find box, and select Clean Rules.
- Edit, next the geocode clean rule. by default. By default, there are four geocode clean rules available.
- Review the clean rule settings.
- Save the clean rule.
- Activate the clean rule.If “Clean all records when this rule is activated or saved” is selected, then geocodes are automatically added to all the existing records. The new records automatically get geocodes when they’re saved. And Existing geocode values are overwritten.
- Repeat the above process for the other geocode clean rules.
- In Salesforce Classic, add the Clean This Record with Data.com related list to the page layout for accounts, contacts, and leads so that if we want to be able to check the clean status of the geocode clean rules.
Note: Geocodes are added to the org records using Data.com technology. However, Data.com license is not really required to use this feature.
Now, add an account with a value of A 61/B 4, Spring Meadows Business Park, Sector 63, Noida, Uttar Pradesh 201301 for the Shipping Address field. When you save this account, values for the ShippingLatitude, ShippingLongitude and ShippingGeocodeAccuracy fields are added.
NOTE: If it does not update the latitude, longitude, and accuracy, follow these steps:
- Open the created account record.
- On the above account detail page, Select the “Clean This Record with Data.com”.
- Click on Clean option in Action.
Thanks Pranav. Nice explaination.