There are various reasons why you would need zip codes populated within zoho crm, they are needed for certain territory extensions, and even general operational use. Unfortunately, there isn’t an option out there that can do this exact function (without paying a lot of money) and with how simple it actually is to accomplish its a wonder why this isn’t easier to find.
Next, you need to create two fields in Zoho CRM one called “Lat” and another called “Long” these can both be single-line fields and are going to be used to store the latitude and longitude from our first API call. After this is done you can create a new workflow that runs a function every time a new module entry is added, using the following deluge code as the “Action”
//Gets lat and long for the variable "address"
data = invokeurl
[
url :"https://maps.googleapis.com/maps/api/geocode/json"
type :GET
parameters:{"address":city + ', ' + state,"key":"YOUR API KEY"}
];
// Gets the results from that request and parses the array to get the exact data we need
result = data.getJSON("results");
geometry = result.getJSON("geometry");
location = geometry.getJSON("location");
lat = location.get("lat");
lng = location.get("lng");
//Stores the Lat and Lng value within the module entry fields we created
mp = Map();
mp.put("Lat",lat);
mp.put("long",lng);
info mp; //to view the map results in the debug
update = zoho.crm.updateRecord("Leads",leadid.toLong(),mp);
//Searches googles api for the first zipcode that matches our lat and long
data = invokeurl
[
url :"https://maps.googleapis.com/maps/api/geocode/json"
type :GET
parameters:{"address":lat + ', ' + lng,"key":"YOUR API KEY"}
];
//Parses the array and stores the Zip Code within our module record
result = data.getJSON("results");
address = result.toJSONList().get(0).getJSON("address_components").toJSONList();
zip = address.get(6).getJSON("long_name");
mp = Map();
mp.put("Zip Code",zip);
info mp;
update = zoho.crm.updateRecord("Leads",leadid.toLong(),mp);
Remember at the end to map the arguments for the address and the leadid. Once you’ve done that add a few records with missing zip codes and test it out.
Do you need help with something like this? Our team at RGC can build simple solutions like this for your business in record time. Get A custom quote for your project
RGC is passionate about sharing improvements with our service partners. If you are a user of one our partner platforms subscribe below to get free solutions and advice you won’t get anywhere else.