Custom Function: Automatically populate the State, City and Country based on the ZIP code (only for US)

Custom Function: Automatically populate the State, City and Country based on the ZIP code (only for US)

Scenario: Automatically populate the State, City and Country based on the ZIP code (only for US)

When a contact, lead or an account is created, you have to fill in the address details manually.

You can save time by populating the value for State, City and Country based on the ZIP code you enter. You just need to enter the ZIP code and the rest will be populated automatically.

Right now, we have done this custom function only for United States ZIP code.

Please follow these steps:

  1. Log in to Zoho CRM with administrative privileges.
  2. Click Setup > Automation > Workflow > Create Rule.
  3. In the New Rule page, choose Leads module from the drop-down list and provide other rule details.
  4. Under Execute On, choose Create or Edit and then click Next.
  5. Specify the Rule Criteria as Zip Code is not Empty. Add additional criteria, if required.
    The
    rule will triggered only when
    a record meets the criteria mentioned here.
  6. In the Actions section, click on the Add button for Call Custom Functions.
  7. In the Configure Custom Function popup, click Write your own.
  8. Specify a name for the function.
  9. Build the Deluge Script based on the code given below.

Deluge Script:

  1.  

void workflowspace.Auto_State_City(string leadId,string zipcode)


  1. {


    pinresp=((getUrl("http://zipfeeder.us/zip?key=<zipfeederAPIKEY>&zips=" + input.zipcode))).toString();//Calling 


    zipfeeder api to get the information


    state = pinresp.executeXPath("/root/zips/state/text()");//Getting State info from the zipfeeder response


    city = pinresp.executeXPath("/root/zips/city/text()");//Getting city info from the zipfeeder response


    county = pinresp.executeXPath("/root/zips/county/text()");//Getting city info from the zipfeeder response


    upresp = zoho.crm.updateRecord("Leads",input.leadId,{ "State" : state, "City" : 


    city,"Country":"USA","County":county});//updating zohocrm lead

    }

Note: This custom function is for the Leads module and this can be used in any module where you want to automatically populate the State, City and Country information based on the Zip Code. You just need to modify the module name and field names in the custom function.


Please refer to the following link to know more about this feature:

https://www.zoho.com/crm/help/automation/custom-functions.html


      • Sticky Posts

      • Tip #35 - On using Kanban View in Zoho CRM

        Hi folks,  It's that time of the week again, and I am back with a quick tip about using Kanban View in Zoho CRM. If you think you missed any of our previous weeks' tips, you can read them here.  Tip #35 - On using Kanban View in Zoho CRM You deal with so many records in CRM every single day! When you click open each module in Zoho CRM, you have hundreds of records, each in various stages of your sales pipeline. Wouldn't it be cool if you had them all sorted automatically without having to filter
      • ZUG (Zoho User Group) In-person Meetups - Learn, share and discuss all things Zoho

        Hi, Hope you all are well. We're excited to announce our second leg of in-person Zoho User Group (ZUG) meetups in your region. A quick update - Our first leg of meetups in 2024 progressed and reached completion smoothly, where Zoho experts had the opportunity
      • ZUG (Zoho User Group) In-person Meetups - Learn, share and discuss all things Zoho

        A big warm hello to the Zoho Community, and Happy new year to all of you! We're thrilled to let you know that our ZUG Meetups for 2024 have almost begun, and we can't wait for you to be a part of them. We have some interesting topics in store for this
      • Cloning Email Templates across modules in Zoho CRM.

        The option of cloning email templates across modules has been a long standing feature request from the Community. Thank you all for being so patient with us. We are happy to inform you all that this enhancement has been rolled out. Just in case you haven't noticed it already, cloning email templates is possible now! Cloning is useful because it cuts down the hassle of having to create the same email templates again for different modules. Here are the steps: Navigate to Settings---> Customization--->Templates
      • CRM Hack #2: Automate sending of birthday greetings to your customers.

          Hello everyone! What sets you apart as a sales person is your ability to add that personal touch to your business relationship with your customers. Sending a gift on a special day, or leaving a note wishing them on their birthdays, are small, yet significant actions that show your customers that you care. And these are actions done without any expectations :) You must be engaging with a lot of customers and it is highly unlikely that they all are your friends on Facebook or some social channel,