Zip Code and Time Zone Lookups in Salesforce.com

One of the projects we've built over and over in many forms in salesforce.com is the zip code lookup to return a city and state or the time zone lookup to get the timezone from a state or area code. These are similar projects in many respects.

In a nutshell, you have some input parameters, a custom object that contains those input parameters and the needed output, and a trigger on the target object that takes the input parameters, does a query against the custom object to find a matching record, and returns the needed data to the target object.

To get you past that gobbledygook I'll give a specific example of the city and state lookup from a zip code. The ideal place to put this functionality is on the lead object, but it could also be done from account or contact addresses.

So lets say that your reps are on the phone with a prospect and they need to enter the prospect's address. They'll get the street address, but instead of asking for the city and state, they could instead just ask for the zip code and leave the city and state fields empty.



Then when they save the record, a trigger from the lead object in salesforce will use the zip code to do a lookup against a zip code salesforce custom object. That object would contain a table filled with all the zip codes in the country, their state, and their city. Once the trigger found a match it would bring the city and state back to the lead object and populate those fields.

Another common request along these lines is a small visualforce page, either as a standalone page or a component that rests in the lead page layout where the address is entered. In this method, as soon as the zip code is entered the system grabs the state and city and populates those fields on the fly. The previously mentioned technique doesn't populate until the lead record is saved. As you can imagine, the salesforce visualforce zip code lookup component is more convenient and user friendly, but it would take a few more hours to implement given the need to create a visualforce page. If you're on a tight budget, you could get by with just the trigger, if you want the function to be a bit more seamless, then the visualforce component for the zip code lookup would be a better choice.

Another common need in salesforce is to determine the time zone automatically from whatever inputs you have available. Normally when speaking with a prospect you have a state and frequently you also have a phone number. From either the lead, account or contact addresses in salesforce, the state can be used to determine the time zone in most cases, but there are a few states out there that contain more than one time zones, like Florida, which enters the central timezone around Panama City. The area code can be used to fine tune the result. Zip codes can also be used to determine the time zone, you just need to obtain a database that contains the timezones by zip code. I found a few pretty quickly via google.

This project would be implemented using the same methodology as the zip code to city state system described above. In this case, the custom object would be called Time Zone and have fields for the inputs, so state, or area code, or zip code. A trigger on the lead object could take the inputs on save and find the matching time zone record and bring back the time zone into the appropriate field on your target object.

Likewise, a visualforce component could also do this if you wanted the timezone lookup to be populated on your lead page layout dynamically right as the inputs were populated. Again, this technique is going to cost more to implement, but it provides for a nicer user interface.

The beauty of salesforce, visualforce, triggers, apex, and the like is that via custom development we can solve these problems in whatever way suits you and your business processes best - and it doesn't have to break the bank. A trigger like described above would cost about $500, the visualforce component might reach $1200 or so. It all depends on the exact requirement, but that gives you an idea of what you might have to spend (with Snapptraffic anyway) to get this built.

If you're doing a project like this, or just need to have this done for you and would like our help, feel free to reach out to us via the contact us page on our website: www.snapptraffic.com. We'd be happy to help with this or any other custom development project or salesforce.com assistance you may need.






3 comments:

Unknown said...

If you are searching for how to get current zip code of your location then check this amazing auto zip code finder.

Merely Rendy said...

Wherever you have to go somewhere, the carrier's zip code you do not know is poliable. You can learn zip code for current location of this place.

Unknown said...

Hello


Is there any way in salesforce using which we can get the timezone based on zip code