Skip to main content
Answer

How can I create a State field from zip code

  • June 11, 2024
  • 3 replies
  • 159 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

Best answer by Troy Tessalone

@ShannonD 

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

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

Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • June 11, 2024

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:

 


  • Author
  • Beginner
  • June 11, 2024

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


Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • Answer
  • June 11, 2024

@ShannonD 

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