+ Start a Discussion
M. J. KahnM. J. Kahn 



I'm using the "Force.com for Google Maps and Earth" code share project pretty much verbatim. (I'd post the code here, but it would just be a copy of what's in the code share project.) The project includes a trigger on the Account object so that whenever an Account's billing address changes, geocoding information is computed and stored in the Account. This worked just fine yesterday, but today, when I change an Account's billing address, the Google Maps API returns a G_GEO_TOO_MANY_QUERIES error.

According to the Google Maps API documentation, "Requests made in excess of your daily and instantaneous throughput limits may return a 620 (G_GEO_TOO_MANY_QUERIES)." I've tried this in two different developer orgs (which happen to be on two different Salesforce instances), and I get the same error in both places. I'm only updating one Account at a time, using the standard UI, so it seems unlikely that I'm personally exceeding some limit.

What determines whether you've gone over the daily limit? If other Salesforce orgs are on the same instance as me (and thereforce issue requests from the same URL and use the same API key), do their requests contribute to a single daily limit?

Is there anything I can do to reset this error, or do I have to wait a day for it to clear on its own?






Where you able to get this issue resolved?  I am getting the same 620 error.




Nope, never got a resolution on it. It seems to be an inherent problem with the fact that the Google Maps API uses the requester's URL and the fact that all users on the same Salesforce instance share the same URL. It's frustrating, since it means that you can't rely on being able to get a response valid from the Maps API.



This is an issue that I hope Salesforce and Google address.  I believe that your API key is shared by everyone on your Salesforce server, be it na5 or na6.  One of the very few issues with multi-tenancy, among all the great benefits.

Experiencing something related...


Using the trigger in the code share returns a "G_GEO_SUCCESS" (and lat & lon) early in the AM and also in the evening.


During the middle of the day however, it doesn't return any status. As its written, the processGeocodeDom method (straight from the codeshare) should save the error code and as well as 0.0 for the lat & lon. But It seems that this code isn't even executing and I'm trying to understand why.



public static void processGeocodeDom( xmldom dom, Account a ) {
if (dom != null) {
if ( dom.root.getValue('code') == '200' ) {
string[] lat_lon = dom.root.getValue('coordinates' ).split(',');
a.lat__c = Double.valueOf(lat_lon[1]);
a.lon__c = Double.valueOf(lat_lon[0]);
a.geocode_status__c = 'G_GEO_SUCCESS';
} else {
a.lat__c = 0.0; a.lon__c = 0.0;
a.geocode_status__c = geo_response.get( dom.root.getValue('code') )
+ ' ('+ dom.root.getValue('code') + ')';


Is it possible/probable that the the @future method times out before it ever receives a return from the geocode method? I'm looking for suggestions on debugging (I'd like to know the return status of the geocoder) but the execution of the @future method doesn't appear in the system log. Should it?




@future (callout=true)
public static void geocodeAccount( list<string> accids ) {

// fetch the address from this account(s)
account[] al = [ select id, name, billingstreet,billingcity,
billingState,billingpostalcode from account where id in :accids];

// store the resulting lat-lon in the accounts
for ( Account a: al) {
string adr = a.billingstreet + ',' + a.billingcity + ',' + a.billingstate;
if ( a.billingpostalcode != null )
adr += ',' + a.billingpostalcode;

xmldom dom = geocode(adr);
processGeocodeDom ( dom , a);
try {
update al;
} catch( System.Exception e) {
System.debug('**********************************Updating Account ERROR: '+ e);






Message Edited by bbrady on 01-27-2010 10:04 AM

Monitoring asynchronous job executions isn't always as easy as it could be -- yet. (I suspect they're working on it.)


Try looking at the AsyncApexJob object. You should see a record get added to that object when your job is queued, and the record should be updated when the job actually runs.


Also, look at Setup / Monitoring. There are a few menu items there that might help you monitor the status of your @future job.

Thanks very much for the response. Curious thing is that the apex jobs show as completed w/o errors.
You might try having your @future method do some System.debug('here I am') calls at various points in the code. If you turn on Debug Logs, you might be able to catch a glimpse of what's happening.

Tried that too. Nothing was written to the log - which made me think the code never even executed. Except that the apex jobs queue indicated otherwise. I do hope SF improves the async debugging capabilities. Debugging 'in the dark' can be a little frustrating.


Again, many thanks!