function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDC TechieSFDC Techie 

How to get geocode for bulk record based on billing address using Google Map API (REST API)

Hi All,

I able to get geocode for single record based on billing adderess  whan insert or update.For this I wrote trigger on account object and calling future callout methos in a class and working good.

But I anable to get geocode  based on billing adderess when insert or update bulk records from dataloader.When I am trying to update more than 50 getting below error like "Too many future calls: 51".

Even though  I have sent list of acount id to future callout method from trigger, in future callout method for each record I am calling webservice so I am getting "Too many future calls: 51".


I also tried to schedule future callout method for evert 1 minute in this getting status 'ok' and status code '200' but geocode is null.

Here is the code

Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://maps.googleapis.com/maps/api/geocode/json?address='+geoAddress + '&key=' + Label.Google_API_Key+'&sensor=false');
request.setMethod('GET');
request.setTimeout(60000);
HttpResponse response = http.send(request);

Please help me how to get geocode for bulkrecords and how to send multiple record in single callout.