Hi is there anyone here who successfully use googl...
# suitescript
t
Hi is there anyone here who successfully use google map api to a 2.0 suitescript ? This is my first time on using google map api it really helps if there are reference you can share. TIA
n
I think I've only ever worked with the maps API using 1.0 years ago... I can have a look though.
Yeah sorry buddy my old code is 1.0
e
I've worked with it extensively for my suiteapp
a
Nothing special
Copy code
if (leadAddress.length > 0){
   for (var y = 0; y<leadAddress.length;y++){
      var response = https.get({
         url: paramURL+leadAddress[y]+'&key='+paramKey
      });
      if(JSON.parse(response.body).results.length > 0){
         log.debug('Google Response',response.body);
         leadCoords.push(JSON.parse(response.body).results[0].geometry.location);
      }else{
         log.error('Error','No Address Found, Google Response:'+response.body);
         return null;
      }
   }
}else{
   log.audit('Warning', 'No Lead Address found, skipping auto assignment!');
   return null;
}
e
One thing to note is that Google only allows caching/storing of data returned from their services for 30 days. You'll need to request whatever data you're looking for every 30 days to follow their license agreement
t
I'm trying to mark all the places nearby and add some pin. Is that possible?
e
Yes, and that could be your entities within a certain radius of a point or using Google's Places service
t
Can I do this using a SUITELET alone? I've seen there is a combination of CSS HTML JS involve.