[Time Zone] "Location not found!" when using GetTimeZoneForLocation

Forge Component
Published on 2018-10-01 by André Vieira
10 votes
Published on 2018-10-01 by André Vieira


I was successfully using the action GetTimeZoneForLocation to obtain a timezone so that I could then use the action ConvertFromUTC to display a timestamp in the correct timezone of the end-users. However, I was doing this for every item in a list. When the list grew bigger (around 10 items), I started having "Location not found!" errors.

After some debugging I found out that the Google API called by the action GetTimeZoneForLocation has some throttling in place and this is what causes the error. When we go over the limit, the API returns the following response:

   "error_message" : "You have exceeded your daily request quota for this API. We recommend registering for a key at the Google Developers Console: https://console.developers.google.com/apis/credentials?project=_",
   "results" : [],
   "status" : "OVER_QUERY_LIMIT"

I lost a bit of time figuring this out because the error message was pointing me in the wrong direction. As a suggestion for improvement, the getLatLng method in the extension could also detect this OVER_QUERY_LIMIT status and return an exception message that would point the developers in the right direction to quickly solve the problem. In my case, I cached the TimeZone returned by GetTimeZoneForLocation so that I would only need to call the Google API once in each session.

Hopefully this may also be useful to anyone else running into the same issue.

Helio Paulo,

i have been looking how to cached the TimeZone from GetTimeZoneForLocation but i can't find where. Can you tell me how to do it?