Skip to main content
Best answer

How can I create a State field from zip code

  • 11 June 2024
  • 3 replies
  • 51 views

I have lead forms coming from Facebook, pushing into Salesforce. 
The forms have Zip but no State. Salesforce will not input the zip code because it doesn’t have the state info.

How could I lookup the state by zip and create new ‘State’ field in my existing form before sending it to Salesforce.

FYI: I know nothing of programming, but Zapier logic makes sense to me.

Thanks,

Shannon D

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Userlevel 7
Badge +14

Hi @ShannonD 

You either need to have a lookup table that has the Zip to State relationships.

Or you would need to use an API that can take a Zip and return a State. (https://app.zipcodebase.com/documentation)

Lookup Table resources:

 

Userlevel 1

Ok, I just read another reply you had on this subject previously.
Would that lookup table need to list each and every zip - 78681 = texas, and on and on?


Or could it list the range of zips per state similar to:
 

  if (zipcode >= 35000 && zipcode <= 36999) {

      st = 'AL';

      state = 'Alabama';

 

} else if (zipcode >= 85000 && zipcode <= 86999) {

      st = 'AZ';

      state = 'Arizona';

 

Thanks,
SD

Userlevel 7
Badge +14

@ShannonD 

If you want to use Code, then use the Code app: https://zapier.com/apps/code/help