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

    • Community Digest - August 2021

      Announcements Canvas for Zoho CRM is LIVE - try the industry's first CRM design studio Introducing new charts and additional metrics in Webform Analytics Execute automation and other processes during import Announcing Multiple Sandbox types and support
    • Community Digest - July 2021

      Announcements Introducing Zoho CRM's new email compose and a lot more exciting latest enhancements Take a look at the revised pricing of Zoho CRM portals Extending the Multiple currency limits and availability for all paid additions Zoho Marketplace houses
    • Focus Group webinar: Part 1 - Zoho CRM’s Blueprint 3.0

      Zoho CRM's Blueprint 3.0 comes with an array of varied new features and enhancements. We made a couple of posts on the community a few months ago, detailing what they do, and how they'll fit in to your business use-cases. You can find them here and here. 
    • Ask the Experts - live forum-based Q&A discussion on building customer insight with Zoho CRM

      We are excited to open the stage for this month's open house discussion. Zoho CRM 2020 release included 16 robust features that covered developing customer insight, experience, intelligence, and foundation in Zoho CRM. We're happy to see a lot of you
    • 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: Log in to Zoho CRM


          Zoho TeamInbox Resources

            Zoho DataPrep Resources


                Zoho CRM Plus Resources

                  Zoho Books Resources


                    Zoho Subscriptions Resources

                      Zoho Desk Resources

                        Zoho Projects Resources


                          Zoho Sprints Resources


                            Zoho Orchestly Resources


                              Zoho Creator Resources


                                Zoho WorkDrive Resources




                                    Zoho Campaigns Resources

                                      Zoho CRM Resources

                                                    Design. Discuss. Deliver.

                                                    Create visually engaging stories with Zoho Show.

                                                    Get Started Now


                                                      Zoho Show Resources


                                                        Zoho Writer Writer

                                                        Get Started. Write Away!

                                                        Writer is a powerful online word processor, designed for collaborative work.

                                                                  有料プランをご利用の方