how to feed values from SOQL to the API, that is feed zip code to the API. And calculate the distance between the two zip code.


If your question is regarding querying zip code from any of the two records in Salesforce to find the distance between them using google api, then below is the code snippet:

List<Account> lstAccounts = [SELECT ShippingPostalCode FROM Account WHERE Name = 'Test1' OR Name = 'Test'];

Http http = new Http();
HttpRequest req = new HttpRequest();
HttpResponse resp;
resp = http.send(req);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.