UK Postcodes in Zoho CRM

UK Postcodes in Zoho CRM

Hello

I have been working on getting postcode lookup of UK addresses into Zoho CRM for a while now, so I thought I would share with the community a solution to get verified UK addresses from a house name / house number and postcode.

Firstly, this works across all modules, from custom modules, to companies, contacts etc.

This is how I did it.

1. Make sure your Zoho CRM module has the following address fields.
          1.  House No or Name
          2. Address Line 1
          3. Address Line 2
          4. Address Line 3
          5. Address Line 4
          6. Locality
          7. Town
         8. Postcode
2. To get those fields created or edited in Zoho CRM head to SETUP>CUSTOMIZATION>MODULES AND FIELDS> and select the module you want to work with
3. Get an API address from a company called “Get Address” - free for 20 postcode lookups a day. Or £100 a year for 2000 postcode lookups a day. (https://getaddress.io)
4. Now in Zoho CRM head to SETUP>AUTOMATION>ACTIONS>FUNCTIONS>CONFIGURE FUNCTION>WRITE YOUR OWN
5. Give the function a name and select the module that you’ve created the address fields above.
6. Paste the code at the bottom of this post into the box next to the number 1
7. Where I have typed XXXXXXXX edit this with your own API number from getaddress above
8. Where I have typed ZZZZZZZZ edit this with the module name e.g “contacts” - remember to use the API name of the module which you can find by going to SETUP>DEVELOPER SPACE>APIs>API NAMES
9. Now the “Edit Arguments” link
            1. Give the arguments function a name again - use the same one as above for ease
             2. In “Parameter Name” type the word “contid” then in the drop down select the first available option called “YOUR MODULE NAME ID”
              3. Click + Add
              4. In “Parameter Name” type the word “house” then in the drop down select the field called “House No or Name”
             5. Click + Add
            6. In next “Parameter Name” type the word “postcode” then in the drop down select the field called “Postcode”
           7. Click save

10. Now click save and you can now use the Automation Workflows to run this script on an edit of a record or similar set up



CODE

resp = getUrl("https://api.getAddress.io/find/" + postcode + "/" + house + "?api-key=XXXXXXXX”).get("addresses");

for each  rec in resp

{

mp = Map();

mp.put("Address_Line_1",rec.get("0"));

mp.put("Address_Line_2",rec.get("1"));

mp.put("Address_Line_3",rec.get("2"));

mp.put("Address_Line_4",rec.get("3"));

mp.put("Locality",rec.get("4"));

mp.put("Town",rec.get("5"));

mp.put("County",rec.get("6"));

update = zoho.crm.update("ZZZZZZZZ",contid,mp);

}