HubSpot Ideas

Yoshi

Auto populate city state based on postal code

Currently, HubSpot form does not support auto populate city or state based on postal code or zip. 

 

It would be great if we could have that feature for HubSpot form. 

32 Replies
JoeMayall
HubSpot Alumni

Hey folks,

 

I've been in contact with our Product team about this Idea, and I wanted to relay the state of our development plans. At this time, autopopulating the city and state based on the postal code is not in our immediate development roadmap. Our team is aware of this Idea, and certainly understands the use case for it, but it isn't something we have scoped out for the immediate future.

 

This isn't to say we'll never build it, or that we have a reason against it, just that the team is focused on other features and tools at this time. All future developments will be relayed through this thread, so please stay tuned and continue to leave feedback.

 

Best,

Joe

aparnarevi
Participant

upvoting this idea as well

SBenfield
Participant

Such an important need for the customer experience when filling out forms on our website as well as the database maintanace across two systems, it's disappointing to see no solution in the 3 years we've been with HubSpot. Pleasw help us with a solution.

mmartelli0803
Participant

Not being able to use lookup or relational tables is prohibiting us from migrating from Salesforce CRM to Hubspot CRM. There has to be a solution. Am I missing something?

FrankMurray
Member

I upvoted this idea over a year ago and this request has been here for a lot longer than that. This isn't some fancy idea - this allows us to ask less of the customer to convert more.  

JDRECQ
Member

It will be a great idea if it could be available in France ! 

DKiwior
Member

Hi, new Hubspot users here.  Getting ready to roll it out to the company and was hoping to get an update...if there is one...on this feature/improvement....  Auto populate city state based on postal code.   Any update since Joe's post on November 10, 2020 ??

 

Sure would be helpful...and there is a great deal of need/interest.

 

Thanks,


Dave

IAkin
Member

Upvote!!

Marc_K
Member

Yes please! I am baffled that this is not a feature.

 

+1

SMcClintock
Member

This would be a great addition to help limit the number of required fields on a contact form.

HarvestROI
Contributor | Platinum Partner

Is there a third-party app that anyone knows of that would do this?

RGeelen
Member

I fixed this issue by creating a workflow with a custom code block.

I used the google geocode api to find the city based on the postalcode of an contact person

 

1. Create a trigger for postalcode and select the option "is known". 

Note: Don't forget to select the postalcode is known in the re-register tab.

 

2. Add the block custom code to your workflow.

 

3. Add your google apikey to the secret field

 

4. Add postalcode to the properties to be included in the code.

at the end it should look like this: 

RGeelen_0-1649758827301.png

 

5. Write the custom code:

This is the code i written to get the city by the postalcode:

const hubspot = require('@hubspot/api-client');
const axios = require('axios');

exports.main = async (event, callback) => {
  const zip = event.inputFields['zip'];
  var city = "";
  var url = [
    "https://maps.googleapis.com/maps/api/geocode/json?components=postal_code:",
    event.inputFields['zip'],
    "|country:NL&key=",
    process.env.GAPIKEY
  ];
  
  // Get city by postalcode using google api
  await axios
  .get(url.join(""))
  .then(res => {
    console.log(`statusCode: ${res.status}`)
    res.data['results'][0]['address_components'].forEach(function (item, index){
      if(item['types'][0] == "locality") {
         city = item['long_name'];
      }
    })
  })
  .catch(error => {
    console.error(error)
  })
  
  callback({
    outputFields: {
      city: city
    }
  });
}

Note: make sure you change the country in the url to your country

 

6. Define city the output fields so it can be used in the workflow

RGeelen_1-1649759397098.png

 

7. Add a new action to the workflow "copy property value", chose the output from the custom code and the value of the contact person in this case city.

RGeelen_2-1649761491023.png

 

Save the workflow and you are done