Posts

Showing posts from July 23, 2016

Get Longitude and Latitude from the Google Api

Image
Requirement: To get longitude and latitude of address using google api in salesforce. When Account is insert/update if account has shipping address then auto fill latitude and longitude values Soloution >> You need to hit google api call. it is free you can call it easily Note>>1)  Add end point URL in Remote site setting SetUp>> remoteSiteSetting>> AddURL:   https://maps.googleapis.com 2) Add two fields as a text type on Account object one is longitude  and othe is latitude  Longitude >> Longitude__c Latitude >> Latitude__c Step 1>> Need to Write trigger on Account Object You need to write two class and one trigger Class 1 /* This class is using for quering Billing address and call Google Map api and find the lattitue and long from API */ public  class AccountGetBillingAdress {   // toCheckFutueCall varibale is a boolean variable if it has alreday exist     private static Boolean toCheckFutueCall = false;