Geocoding New or Updated Records Immediately (Real Time Geocoding)

By default, any new records you add to Salesforce aren't available on the map until the geocoder batch job runs. Similarly, address updates aren't reflect in Geopointe until a batch job runs and identifies those updates. However, having up-to-date data at all times may be crucial for your organization.

The solution? Real time geocoding. In this document, we will cover the basics of how to set up real time geocoding for your objects. For standard objects, a simple check box will do the trick. For custom objects, writing a trigger is required. 

IMPORTANT: Since it uses a trigger, we recommend testing real time geocoding in a sandbox before enabling in a production environment. Mass imports of records can overload the system, especially if other processes are running. 

Standard Objects
Custom Objects

Standard Objects

To turn on real time geocoding for a standard object, create or edit the Map Object for that object, then check the Real Time Geocoding checkbox in the Advanced Options section. Keep in mind that this checkbox will activate a trigger in the background, so it is recommended that you test it in sandbox first.

Custom Objects

To set up real time geocoding for a custom object, a developer will need to write the trigger. Since every org and need is different, we cannot provide the exact code, but here is an outline of what is required:
  • In an insert trigger, check to see if the trigger size of records being inserted is ==1. Only proceed if size is 1. 
  • You will need to setup an apex class with an @future method to handle these inserts. It will be called from the trigger as the geocoding performs an HTTP callout. This cannot happen from a trigger.
  • In the @future method, you will need to use the Geopointe Apex api and call the geopointe.API.geocodeRecord(recordId); method. This will geocode the inserted record.