I'd like to use the Salesforce account Geolocation fields (billing address latitude and longitude) to assign accounts to specific geographical zones.
Salesforce automatically updates the billing address latitude and longitude when the account is created - the problem I'm running into is the slight (second or less) lag time between the creation of the record, and Salesforce's automatic update of the coordinates.
When the coordinates are referenced in a class called by the After Insert trigger, they return null.
The only workarounds I've come up with are - using the Google Maps API (but callout limits may be exceeded), trying a hacky sleep function, or writing a schedulable batch that processes new accounts - but I could see this frustrating users as they wait for the info to be populated on their new accounts.
Hoping there's another option I'm missing here - thanks for any advice.
Just a warning to anyone else who may need to do something similar - got this working thanks to the advice here but initially the update of the Geolocation fields still bypassed the After Update trigger - even with the Bypass Trigger checkbox unchecked. A Process Builder process (that ran on account creation/update) seemed to be the cause. Once that process was deactivated all began to work as expected.