Zoho CRM/Deluge: Get TimeZone Based on GeoCoded Address (Lat/Lng)
- Joel Lipman
- Zoho
- Hits: 2771
An article with a quick snippet of code which builds up the address from a Lead record to geocode into latitude and longitude coordinates to feed a third-party API which returns a timezone.
Why?
Our use-case is that we have a field called "Customer's Time Zone" on the lead record in ZohoCRM. It should be auto-populated...
How?
As mentioned, we're going to use the address on the Lead record; use Zoho's GeoCode function to convert this into a latitude and longitude, then we're going to use a free TimeZone API (one that returns a timezone given a lat/lng). The added feature is that we are going to loop through picklist options (500 timezones) in CRM to select the most relevant one. If all this fails, then it defaults to a module called "States" which stores a default timezone and can be searched for with the "State" field on the Lead record.